Module ast

Source
Expand description

SQL Abstract Syntax Tree (AST) types

Structs§

AlterTable
ALTER TABLE
Analyze
Assert
ASSERT <condition> [AS <message>]
Assignment
SQL assignment foo = expr as used in SQLUpdate
Between
<expr> [ NOT ] BETWEEN <low> AND <high>
BinaryOp
Binary operation e.g. 1 + 1 or foo > bar
Case
CASE [<operand>] WHEN <condition> THEN <result> ... [ELSE <result>] END
Cast
CAST an expression to a different data type e.g. CAST(foo AS VARCHAR(123))
Check
[ CONSTRAINT <name> ] CHECK (<expr>)
Collate
expr COLLATE collation
ColumnDef
SQL column definition
ColumnOptionDef
An optionally-named ColumnOption: [ CONSTRAINT <name> ] <column-option>.
Commit
COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
Copy
CreateDatabase
CREATE DATABASE
CreateIndex
CREATE INDEX
CreateSchema
CREATE SCHEMA
CreateTable
CREATE TABLE
CreateView
CREATE VIEW
CreateVirtualTable
SQLite’s CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)
Cte
A single CTE (used after WITH): alias [(col1, col2, ...)] AS ( query ) The names in the column list before AS, when specified, replace the names of the columns returned by the query. The parser does not validate that the number of columns in the query matches the number of columns in the query.
Deallocate
DEALLOCATE [ PREPARE ] { name | ALL }
Delete
DELETE
Directory
Drop
DROP
Execute
EXECUTE name [ ( parameter [, ...] ) ]
Explain
EXPLAIN
Extract
EXTRACT(DateTimeField FROM )
Fetch
ForeignKey
A referential integrity constraint ([ CONSTRAINT <name> ] FOREIGN KEY (<columns>) REFERENCES <foreign_table> (<referred_columns>) { [ON DELETE <referential_action>] [ON UPDATE <referential_action>] | [ON UPDATE <referential_action>] [ON DELETE <referential_action>] }).
Function
A function call
HiveFormat
Ident
An identifier, decomposed into its value or character data and the quote style.
InList
[ NOT ] IN (val1, val2, ...)
InSubquery
[ NOT ] IN (SELECT ...)
Insert
Join
LateralView
A hive LATERAL VIEW with potential column aliases
ListAgg
A LISTAGG invocation LISTAGG( [ DISTINCT ] <expr>[, <separator> ] [ON OVERFLOW <on_overflow>] ) ) [ WITHIN GROUP (ORDER BY <within_group1>[, ...] ) ]
MapAccess
Msck
Msck (Hive)
ObjectName
A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj
Offset
OrderByExpr
An ORDER BY expression
Prepare
PREPARE name [ ( data_type [, ...] ) ] AS statement
Query
The most complete variant of a SELECT query expression, optionally including WITH, UNION / other set operations, and ORDER BY.
Rollback
ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
Select
A restricted variant of SELECT (without CTEs/ORDER BY), which may appear either as the only body item of an SQLQuery, or as an operand to a set operation like UNION.
SetTransaction
SET TRANSACTION ...
SetVariable
SET
ShowColumns
SHOW COLUMNS
ShowCreate
SHOW CREATE TABLE
ShowVariable
SHOW
SqlOption
StartTransaction
{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...
Substring
SUBSTRING( [FROM ] [FOR ])
TableAlias
TableWithJoins
Top
Trim
TRIM([BOTH | LEADING | TRAILING] [FROM ])
Or
TRIM()
Truncate
Truncate (Hive)
TryCast
TRY_CAST an expression to a different data type e.g. TRY_CAST(foo AS VARCHAR(123))
TypedString
A constant of form <data_type> 'value'. This can represent ANSI SQL DATE, TIME, and TIMESTAMP literals (such as DATE '2020-01-01'), as well as constants of other types (a non-standard PostgreSQL extension).
UnaryOp
Unary operation e.g. NOT foo
Unique
[ CONSTRAINT <name> ] { PRIMARY KEY | UNIQUE } (<columns>)
Update
UPDATE
Values
WindowFrame
Specifies the data processed by a window function, e.g. RANGE UNBOUNDED PRECEDING or ROWS BETWEEN 5 PRECEDING AND CURRENT ROW.
WindowSpec
A window specification (i.e. OVER (PARTITION BY .. ORDER BY .. etc.))
With

Enums§

AddDropSync
AlterTableOperation
An ALTER TABLE (Statement::AlterTable) operation
BinaryOperator
Binary operators
ColumnOption
ColumnOptions are modifiers that follow a column definition in a CREATE TABLE statement.
DataType
SQL data types
DateTimeField
Expr
An SQL expression of any type.
FileFormat
External table’s available file format
FunctionArg
HiveDistributionStyle
HiveIOFormat
HiveRowFormat
JoinConstraint
JoinOperator
ListAggOnOverflow
The ON OVERFLOW clause of a LISTAGG invocation
ObjectType
OffsetRows
Stores the keyword after OFFSET <number>
ReferentialAction
<referential_action> = { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }
SelectItem
One item of the comma-separated list following SELECT
SetExpr
A node in a tree, representing a “query body” expression, roughly: SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]
SetOperator
SetVariableValue
ShowCreateObject
ShowStatementFilter
SqliteOnConflict
Sqlite specific syntax
Statement
A top-level statement (SELECT, INSERT, CREATE, etc.)
TableConstraint
A table-level constraint, specified in a CREATE TABLE or an ALTER TABLE ADD <constraint> statement.
TableFactor
A table name or a parenthesized subquery with an optional alias
TransactionAccessMode
TransactionIsolationLevel
TransactionMode
TrimWhereField
UnaryOperator
Unary operators
Value
Primitive SQL values such as number and string
WindowFrameBound
Specifies WindowFrame’s start_bound and end_bound
WindowFrameUnits