Module models_parser::ast [−][src]
Expand description
SQL Abstract Syntax Tree (AST) types
Structs
ALTER TABLE
ASSERT <condition> [AS <message>]
SQL assignment foo = expr
as used in SQLUpdate
<expr> [ NOT ] BETWEEN <low> AND <high>
Binary operation e.g. 1 + 1
or foo > bar
CASE [<operand>] WHEN <condition> THEN <result> ... [ELSE <result>] END
CAST an expression to a different data type e.g. CAST(foo AS VARCHAR(123))
[ CONSTRAINT <name> ] CHECK (<expr>)
expr COLLATE collation
SQL column definition
An optionally-named ColumnOption
: [ CONSTRAINT <name> ] <column-option>
.
COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
CREATE DATABASE
CREATE INDEX
CREATE SCHEMA
CREATE TABLE
CREATE VIEW
SQLite’s CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)
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 [ PREPARE ] { name | ALL }
DELETE
DROP
EXECUTE name [ ( parameter [, ...] ) ]
EXPLAIN
EXTRACT(DateTimeField FROM
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>] }
).
A function call
An identifier, decomposed into its value or character data and the quote style.
[ NOT ] IN (val1, val2, ...)
[ NOT ] IN (SELECT ...)
A hive LATERAL VIEW with potential column aliases
A LISTAGG
invocation LISTAGG( [ DISTINCT ] <expr>[, <separator> ] [ON OVERFLOW <on_overflow>] ) ) [ WITHIN GROUP (ORDER BY <within_group1>[, ...] ) ]
Msck (Hive)
A name of a table, view, custom type, etc., possibly multi-part, i.e. db.schema.obj
An ORDER BY
expression
PREPARE name [ ( data_type [, ...] ) ] AS statement
The most complete variant of a SELECT
query expression, optionally
including WITH
, UNION
/ other set operations, and ORDER BY
.
ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
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
.
SET TRANSACTION ...
SET
SHOW COLUMNS
SHOW CREATE TABLE
SHOW
{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...
SUBSTRING(
TRIM([BOTH | LEADING | TRAILING]
Or
TRIM(
Truncate (Hive)
TRY_CAST an expression to a different data type e.g. TRY_CAST(foo AS VARCHAR(123))
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).
Unary operation e.g. NOT foo
[ CONSTRAINT <name> ] { PRIMARY KEY | UNIQUE } (<columns>)
UPDATE
Specifies the data processed by a window function, e.g.
RANGE UNBOUNDED PRECEDING
or ROWS BETWEEN 5 PRECEDING AND CURRENT ROW
.
A window specification (i.e. OVER (PARTITION BY .. ORDER BY .. etc.)
)
Enums
An ALTER TABLE
(Statement::AlterTable
) operation
Binary operators
ColumnOption
s are modifiers that follow a column definition in a CREATE TABLE
statement.
SQL data types
An SQL expression of any type.
External table’s available file format
The ON OVERFLOW
clause of a LISTAGG invocation
Stores the keyword after OFFSET <number>
<referential_action> = { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }
One item of the comma-separated list following SELECT
A node in a tree, representing a “query body” expression, roughly:
SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]
Sqlite specific syntax
A top-level statement (SELECT, INSERT, CREATE, etc.)
A table-level constraint, specified in a CREATE TABLE
or an
ALTER TABLE ADD <constraint>
statement.
A table name or a parenthesized subquery with an optional alias
Unary operators
Primitive SQL values such as number and string
Specifies WindowFrame’s start_bound
and end_bound