Expand description
SQL Abstract Syntax Tree (AST) types
Modules§
- defs 🔒
- This module houses the definitions of the structs and enums that are formally part of the AST.
- display
- fold
- Transformation of an owned AST.
- metadata 🔒
- visit
- Traversal of an immutable AST.
- visit_
mut - Traversal of a mutable AST.
Structs§
- Abbreviated
Grant Statement - Abbreviated
Revoke Statement - Alter
Cluster Statement ALTER CLUSTER .. SET ...
- Alter
Connection Option - An option in an
ALTER CONNECTION...
statement. - Alter
Connection Statement ALTER CONNECTION
- Alter
Default Privileges Statement ALTER DEFAULT PRIVILEGES ...
- Alter
Index Statement ALTER INDEX ... {RESET, SET}
- Alter
Network Policy Statement - AN
ALTER NETWORK POLICY
statement. - Alter
Object Rename Statement ALTER <OBJECT> ... RENAME TO
- Alter
Object Swap Statement ALTER <OBJECT> SWAP ...
- Alter
Owner Statement ALTER <OBJECT> ... OWNER TO
- Alter
Retain History Statement ALTER <OBJECT> ... [RE]SET (RETAIN HISTORY [FOR ...])
- Alter
Role Statement ALTER ROLE
- Alter
Secret Statement ALTER SECRET ... AS
- Alter
SetCluster Statement ALTER SET CLUSTER
- Alter
Sink Statement - Alter
Source AddSubsource Option - An option in an
ALTER SOURCE...ADD SUBSOURCE
statement. - Alter
Source Statement - Alter
System Reset AllStatement ALTER SYSTEM RESET ALL
- Alter
System Reset Statement ALTER SYSTEM RESET ...
- Alter
System SetStatement ALTER SYSTEM SET ...
- Alter
Table AddColumn Statement ALTER TABLE ... ADD COLUMN ...
- Assignment
- SQL assignment
foo = expr
as used in SQLUpdate - Avro
DocOn - Avro
Schema Option - Close
Statement CLOSE ...
- Cluster
Alter Option - An option in a
ALTER CLUSTER... WITH
statement. - Cluster
Alter Until Ready Option - Cluster
Feature - Cluster
Option - An option in a
CREATE CLUSTER
statement. - Column
Def - SQL column definition
- Column
Name - Column
Option Def - An optionally-named
ColumnOption
:[ CONSTRAINT <name> ] <column-option>
. - Comment
Statement COMMENT ON ...
- Commit
Statement COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
- Connection
Default AwsPrivatelink - Connection
Option - An option in a
CREATE CONNECTION
. - Continual
Task Option - Copy
Option - Copy
Statement COPY
- Create
Cluster Replica Statement CREATE CLUSTER REPLICA ..
- Create
Cluster Statement CREATE CLUSTER ..
- Create
Connection Option - An option in a
CREATE CONNECTION...
statement. - Create
Connection Statement CREATE CONNECTION
refactor WIP- Create
Continual Task Statement CREATE CONTINUAL TASK
- Create
Database Statement CREATE DATABASE
- Create
Index Statement CREATE INDEX
- Create
Materialized View Statement CREATE MATERIALIZED VIEW
- Create
Network Policy Statement - A
CREATE NETWORK POLICY
statement. - Create
Role Statement - A
CREATE ROLE
statement. - Create
Schema Statement CREATE SCHEMA
- Create
Secret Statement - A
CREATE SECRET
statement. - Create
Sink Option - Create
Sink Statement CREATE SINK
- Create
Source Option - An option in a
CREATE SOURCE...
statement. - Create
Source Statement CREATE SOURCE
- Create
Subsource Option - Create
Subsource Statement CREATE SUBSOURCE
- Create
Table From Source Statement CREATE TABLE .. FROM SOURCE
- Create
Table Statement CREATE TABLE
- Create
Type List Option - Create
Type MapOption - Create
Type Statement CREATE TYPE ..
- Create
View Statement CREATE VIEW
- Create
Webhook Source Body BODY [AS ...] [BYTES]
- Create
Webhook Source Check CHECK ( ... )
- Create
Webhook Source Check Options CHECK ( WITH ( ... ) )
- Create
Webhook Source Filter Header - Create
Webhook Source Header HEADER [AS ...] [BYTES]
- Create
Webhook Source Include Headers INCLUDE [HEADER | HEADERS]
- Create
Webhook Source MapHeader INCLUDE HEADER <name> [AS <alias>] [BYTES]
- Create
Webhook Source Secret SECRET ... [AS ...] [BYTES]
- Create
Webhook Source Statement CREATE (SOURCE | TABLE) <name> FROM WEBHOOK
- CsrConfig
Option - An option in a
{FROM|INTO} CONNECTION ...
statement. - CsrConnection
- CsrConnection
Avro - CsrConnection
Protobuf - CsrSeed
Avro - CsrSeed
Protobuf - CsrSeed
Protobuf Schema - Cte
- A single CTE (used after
WITH
):alias [(col1, col2, ...)] AS ( query )
The names in the column list beforeAS
, 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. - CteMut
Rec - CteMut
RecColumn Def - A column definition in a
CteMutRec
. - Deallocate
Statement DEALLOCATE ...
- Declare
Statement DECLARE ...
- Delete
Statement DELETE
- Discard
Statement - Drop
Objects Statement DROP
- Drop
Owned Statement DROP OWNED BY ...
- Execute
Statement EXECUTE ...
- Explain
Analyze Statement - Explain
Plan Option - Explain
Plan Statement - Explain
Pushdown Statement - Explain
Sink Schema Statement - Explain
Timestamp Statement - External
Reference Export - A selected external reference in a FOR TABLES (..) statement
- Fetch
Option - Fetch
Statement FETCH ...
- Function
- A function call
- Grant
Privileges Statement GRANT ...
- Grant
Role Statement GRANT ...
- Ident
- An identifier.
- Index
Option - Insert
Statement INSERT
- Inspect
Shard Statement INSPECT SHARD <id>
- Interval
Value - An intermediate value for Intervals, which tracks all data from the user, as well as the computed ParsedDateTime.
- Join
- Kafka
Broker - Kafka
Broker AwsPrivatelink - Kafka
Broker AwsPrivatelink Option - Kafka
Sink Config Option - Kafka
Sink Key - Kafka
Source Config Option - Limit
- Load
Generator Option - An option in a
CREATE CONNECTION...SSH
. - MapEntry
- Materialized
View Option - MutRec
Block - MutRec
Block Option - MySql
Config Option - An option in a
{FROM|INTO} CONNECTION ...
statement. - Network
Policy Option - Network
Policy Rule Definition - Network
Policy Rule Option - Op
- A reference to an operator.
- Order
ByExpr - SQL ORDER BY expression
- PgConfig
Option - An option in a
{FROM|INTO} CONNECTION ...
statement. - Prepare
Statement PREPARE ...
- Qualified
Replica - Query
- The most complete variant of a
SELECT
query expression, optionally includingWITH
,UNION
/ other set operations, andORDER BY
. - Raise
Statement RAISE ...
- Raw
- Reassign
Owned Statement REASSIGN OWNED ...
- Refresh
AtOption Value - Refresh
Every Option Value - Replica
Definition - Replica
Option - An option in a
CREATE CLUSTER REPLICA
statement. - Reset
Variable Statement RESET <variable>
- Revoke
Privileges Statement REVOKE ...
- Revoke
Role Statement REVOKE ...
- Rollback
Statement ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
- Schema
- Select
- A restricted variant of
SELECT
(without CTEs/ORDER BY
), which may appear either as the only body item of anSQLQuery
, or as an operand to a set operation likeUNION
. - Select
Option - Select
Statement SELECT
- SetTransaction
Statement SET TRANSACTION ...
- SetVariable
Statement SET <variable>
- Show
Columns Statement SHOW COLUMNS
- Show
Create Cluster Statement - Show
Create Connection Statement SHOW [REDACTED] CREATE CONNECTION <connection>
- Show
Create Index Statement SHOW [REDACTED] CREATE INDEX <index>
- Show
Create Materialized View Statement SHOW [REDACTED] CREATE MATERIALIZED VIEW <name>
- Show
Create Sink Statement SHOW [REDACTED] CREATE SINK <sink>
- Show
Create Source Statement SHOW [REDACTED] CREATE SOURCE <source>
- Show
Create Table Statement SHOW [REDACTED] CREATE TABLE <table>
- Show
Create View Statement SHOW [REDACTED] CREATE VIEW <view>
- Show
Objects Statement SHOW <object>S
- Show
Variable Statement SHOW <variable>
- SqlServer
Config Option - An option in a
{FROM|INTO} CONNECTION ...
statement. - Start
Transaction Statement { BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...
- Subscribe
Option - Subscribe
Statement SUBSCRIBE
- Subscript
Position - Table
Alias - Table
From Source Option - Table
Option - Table
With Joins - Unresolved
Database Name - A name of a database
- Unresolved
Item Name - A name of a table, view, custom type, etc. that lives in a schema, possibly multi-part, i.e. db.schema.obj
- Unresolved
Schema Name - A name of a schema
- Update
Statement UPDATE
- Validate
Connection Statement VALIDATE CONNECTION
- Value
Error - Values
- Version
- View
Definition - Window
Frame - Specifies the data processed by a window function, e.g.
RANGE UNBOUNDED PRECEDING
orROWS BETWEEN 5 PRECEDING AND CURRENT ROW
. - Window
Spec - A window specification (i.e.
OVER (PARTITION BY .. ORDER BY .. etc.)
) Includes potential IGNORE NULLS or RESPECT NULLS from before the OVER clause.
Enums§
- Abbreviated
Grant OrRevoke Statement - Alter
Cluster Action - Alter
Connection Action - Alter
Connection Option Name - Alter
Index Action - Alter
Role Option ALTER ROLE ... [ WITH | SET ] ...
- Alter
Sink Action - Alter
Source Action - Alter
Source AddSubsource Option Name - AsOf
- Avro
Schema - Avro
Schema Option Name - Catalog
Name - Cluster
Alter Option Name - Cluster
Alter Option Value - Cluster
Alter Until Ready Option Name - Cluster
Feature Name - Cluster
Option Name - Cluster
Schedule Option Value - Column
Option ColumnOption
s are modifiers that follow a column definition in aCREATE TABLE
statement.- Column
Versioned - Comment
Object Type - Connection
Option Name - Continual
Task Option Name - Continual
Task Stmt - Copy
Direction - Copy
Option Name - Copy
Relation - Copy
Target - Create
Connection Option Name - Create
Connection Type - Create
Continual Task Sugar - Create
Sink Connection - Create
Sink Option Name - An option in a
CREATE SINK
statement. - Create
Source Connection - Create
Source Option Name - Create
Subsource Option Name - An option in a
CREATE SUBSOURCE
statement. - Create
Type As CREATE TYPE .. AS <TYPE>
- Create
Type List Option Name - Create
Type MapOption Name - CsrConfig
Option Name - CsvColumns
- CteBlock
- A block of common table expressions (CTEs).
- Date
Time Field - Deferred
Item Name - Discard
Target - Distinct
- DocOn
Identifier - DocOn
Schema - Explain
Analyze Computation Property - Explain
Analyze Property - Explain
Format - Explain
Plan Option Name - Explain
Sink Schema For - Explain
Stage - Specifies what Statement::ExplainPlan is actually explained.
- Explainee
- What is being explained. The bools mean whether this is an EXPLAIN BROKEN.
- Expr
- An SQL expression of any type.
- External
References - Specifies which set of external references to generate a source export
for in a
CREATE SOURCE
statement. - Fetch
Direction - Fetch
Option Name - Format
- Format
Specifier - Function
Args - Arguments for a function call.
- Grant
Target AllSpecification - Grant
Target Specification - Grant
Target Specification Inner - Homogenizing
Function - Ident
Error - IfExists
Behavior - Index
Option Name - An option in a
CREATE CLUSTER
statement. - Insert
Source - IsExpr
Construct - Join
Constraint - Join
Operator - Kafka
Broker AwsPrivatelink Option Name - Kafka
Broker Tunnel - Kafka
Sink Config Option Name - Kafka
Source Config Option Name - KeyConstraint
- A key constraint, specified in a
CREATE SOURCE
. - Load
Generator - Load
Generator Option Name - Materialized
View Option Name - MutRec
Block Option Name - MySql
Config Option Name - Named
Plan - An enum of named plans that identifies specific stages in an optimizer trace where these plans can be found.
- Network
Policy Option Name - Network
Policy Rule Option Name - Notice
Severity - Object
Type - PgConfig
Option Name - Privilege
- Privilege
Specification - Protobuf
Schema - RawCluster
Name - RawData
Type - SQL data types
- RawItem
Name - RawNetwork
Policy Name - Reader
Schema Selection Strategy - Refresh
Option Value - Replica
Option Name - Role
Attribute - Attributes that can be attached to roles.
- Select
Item - One item of the comma-separated list following
SELECT
- Select
Option Name - SetExpr
- A node in a tree, representing a “query body” expression, roughly:
SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]
- SetOperator
- SetRole
Var ALTER ROLE role_name [SET | RESET] ...
- SetVariable
To - SetVariable
Value - Show
Object Type - Show
Statement - Show
Statement Filter - Sink
Envelope - Source
Envelope - Source
Error Policy - Source
Include Metadata - SqlServer
Config Option Name - Statement
- A top-level statement (SELECT, INSERT, CREATE, etc.)
- Statement
Kind - Subscribe
Option Name - Subscribe
Output - Subscribe
Relation - System
Object Type - Table
Constraint - A table-level constraint, specified in a
CREATE TABLE
or anALTER TABLE ADD <constraint>
statement. - Table
Factor - A table name or a parenthesized subquery with an optional alias
- Table
From Source Columns CREATE TABLE .. FROM SOURCE
columns specification can have 3 states: Before purification they can beNotSpecified
orNamed
by the user to specify the column names to use. After purification they can be in any of the 3 states. For some source types we define the columns during purification and for others the columns are defined during planning based on the encoding option of the source.- Table
From Source Option Name - Table
Option Name - Target
Role Specification - Transaction
Access Mode - Transaction
Isolation Level - Transaction
Mode - Unresolved
Object Name - Value
- Primitive SQL values.
- Window
Frame Bound - Specifies WindowFrame’s
start_bound
andend_bound
- Window
Frame Units - With
Option Value
Traits§
- AstInfo
- This represents the metadata that lives next to an AST, as we take it through various stages in the planning process.
Functions§
- statement_
kind_ label_ value - A static str for each statement kind