Module ast

Source
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§

AbbreviatedGrantStatement
AbbreviatedRevokeStatement
AlterClusterStatement
ALTER CLUSTER .. SET ...
AlterConnectionOption
An option in an ALTER CONNECTION... statement.
AlterConnectionStatement
ALTER CONNECTION
AlterDefaultPrivilegesStatement
ALTER DEFAULT PRIVILEGES ...
AlterIndexStatement
ALTER INDEX ... {RESET, SET}
AlterNetworkPolicyStatement
AN ALTER NETWORK POLICY statement.
AlterObjectRenameStatement
ALTER <OBJECT> ... RENAME TO
AlterObjectSwapStatement
ALTER <OBJECT> SWAP ...
AlterOwnerStatement
ALTER <OBJECT> ... OWNER TO
AlterRetainHistoryStatement
ALTER <OBJECT> ... [RE]SET (RETAIN HISTORY [FOR ...])
AlterRoleStatement
ALTER ROLE
AlterSecretStatement
ALTER SECRET ... AS
AlterSetClusterStatement
ALTER SET CLUSTER
AlterSinkStatement
AlterSourceAddSubsourceOption
An option in an ALTER SOURCE...ADD SUBSOURCE statement.
AlterSourceStatement
AlterSystemResetAllStatement
ALTER SYSTEM RESET ALL
AlterSystemResetStatement
ALTER SYSTEM RESET ...
AlterSystemSetStatement
ALTER SYSTEM SET ...
AlterTableAddColumnStatement
ALTER TABLE ... ADD COLUMN ...
Assignment
SQL assignment foo = expr as used in SQLUpdate
AvroDocOn
AvroSchemaOption
CloseStatement
CLOSE ...
ClusterAlterOption
An option in a ALTER CLUSTER... WITH statement.
ClusterAlterUntilReadyOption
ClusterFeature
ClusterOption
An option in a CREATE CLUSTER statement.
ColumnDef
SQL column definition
ColumnName
ColumnOptionDef
An optionally-named ColumnOption: [ CONSTRAINT <name> ] <column-option>.
CommentStatement
COMMENT ON ...
CommitStatement
COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]
ConnectionDefaultAwsPrivatelink
ConnectionOption
An option in a CREATE CONNECTION.
ContinualTaskOption
CopyOption
CopyStatement
COPY
CreateClusterReplicaStatement
CREATE CLUSTER REPLICA ..
CreateClusterStatement
CREATE CLUSTER ..
CreateConnectionOption
An option in a CREATE CONNECTION... statement.
CreateConnectionStatement
CREATE CONNECTION refactor WIP
CreateContinualTaskStatement
CREATE CONTINUAL TASK
CreateDatabaseStatement
CREATE DATABASE
CreateIndexStatement
CREATE INDEX
CreateMaterializedViewStatement
CREATE MATERIALIZED VIEW
CreateNetworkPolicyStatement
A CREATE NETWORK POLICY statement.
CreateRoleStatement
A CREATE ROLE statement.
CreateSchemaStatement
CREATE SCHEMA
CreateSecretStatement
A CREATE SECRET statement.
CreateSinkOption
CreateSinkStatement
CREATE SINK
CreateSourceOption
An option in a CREATE SOURCE... statement.
CreateSourceStatement
CREATE SOURCE
CreateSubsourceOption
CreateSubsourceStatement
CREATE SUBSOURCE
CreateTableFromSourceStatement
CREATE TABLE .. FROM SOURCE
CreateTableStatement
CREATE TABLE
CreateTypeListOption
CreateTypeMapOption
CreateTypeStatement
CREATE TYPE ..
CreateViewStatement
CREATE VIEW
CreateWebhookSourceBody
BODY [AS ...] [BYTES]
CreateWebhookSourceCheck
CHECK ( ... )
CreateWebhookSourceCheckOptions
CHECK ( WITH ( ... ) )
CreateWebhookSourceFilterHeader
CreateWebhookSourceHeader
HEADER [AS ...] [BYTES]
CreateWebhookSourceIncludeHeaders
INCLUDE [HEADER | HEADERS]
CreateWebhookSourceMapHeader
INCLUDE HEADER <name> [AS <alias>] [BYTES]
CreateWebhookSourceSecret
SECRET ... [AS ...] [BYTES]
CreateWebhookSourceStatement
CREATE (SOURCE | TABLE) <name> FROM WEBHOOK
CsrConfigOption
An option in a {FROM|INTO} CONNECTION ... statement.
CsrConnection
CsrConnectionAvro
CsrConnectionProtobuf
CsrSeedAvro
CsrSeedProtobuf
CsrSeedProtobufSchema
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.
CteMutRec
CteMutRecColumnDef
A column definition in a CteMutRec.
DeallocateStatement
DEALLOCATE ...
DeclareStatement
DECLARE ...
DeleteStatement
DELETE
DiscardStatement
DropObjectsStatement
DROP
DropOwnedStatement
DROP OWNED BY ...
ExecuteStatement
EXECUTE ...
ExplainAnalyzeStatement
ExplainPlanOption
ExplainPlanStatement
ExplainPushdownStatement
ExplainSinkSchemaStatement
ExplainTimestampStatement
ExternalReferenceExport
A selected external reference in a FOR TABLES (..) statement
FetchOption
FetchStatement
FETCH ...
Function
A function call
GrantPrivilegesStatement
GRANT ...
GrantRoleStatement
GRANT ...
Ident
An identifier.
IndexOption
InsertStatement
INSERT
InspectShardStatement
INSPECT SHARD <id>
IntervalValue
An intermediate value for Intervals, which tracks all data from the user, as well as the computed ParsedDateTime.
Join
KafkaBroker
KafkaBrokerAwsPrivatelink
KafkaBrokerAwsPrivatelinkOption
KafkaSinkConfigOption
KafkaSinkKey
KafkaSourceConfigOption
Limit
LoadGeneratorOption
An option in a CREATE CONNECTION...SSH.
MapEntry
MaterializedViewOption
MutRecBlock
MutRecBlockOption
MySqlConfigOption
An option in a {FROM|INTO} CONNECTION ... statement.
NetworkPolicyOption
NetworkPolicyRuleDefinition
NetworkPolicyRuleOption
Op
A reference to an operator.
OrderByExpr
SQL ORDER BY expression
PgConfigOption
An option in a {FROM|INTO} CONNECTION ... statement.
PrepareStatement
PREPARE ...
QualifiedReplica
Query
The most complete variant of a SELECT query expression, optionally including WITH, UNION / other set operations, and ORDER BY.
RaiseStatement
RAISE ...
Raw
ReassignOwnedStatement
REASSIGN OWNED ...
RefreshAtOptionValue
RefreshEveryOptionValue
ReplicaDefinition
ReplicaOption
An option in a CREATE CLUSTER REPLICA statement.
ResetVariableStatement
RESET <variable>
RevokePrivilegesStatement
REVOKE ...
RevokeRoleStatement
REVOKE ...
RollbackStatement
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 an SQLQuery, or as an operand to a set operation like UNION.
SelectOption
SelectStatement
SELECT
SetTransactionStatement
SET TRANSACTION ...
SetVariableStatement
SET <variable>
ShowColumnsStatement
SHOW COLUMNS
ShowCreateClusterStatement
ShowCreateConnectionStatement
SHOW [REDACTED] CREATE CONNECTION <connection>
ShowCreateIndexStatement
SHOW [REDACTED] CREATE INDEX <index>
ShowCreateMaterializedViewStatement
SHOW [REDACTED] CREATE MATERIALIZED VIEW <name>
ShowCreateSinkStatement
SHOW [REDACTED] CREATE SINK <sink>
ShowCreateSourceStatement
SHOW [REDACTED] CREATE SOURCE <source>
ShowCreateTableStatement
SHOW [REDACTED] CREATE TABLE <table>
ShowCreateViewStatement
SHOW [REDACTED] CREATE VIEW <view>
ShowObjectsStatement
SHOW <object>S
ShowVariableStatement
SHOW <variable>
SqlServerConfigOption
An option in a {FROM|INTO} CONNECTION ... statement.
StartTransactionStatement
{ BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...
SubscribeOption
SubscribeStatement
SUBSCRIBE
SubscriptPosition
TableAlias
TableFromSourceOption
TableOption
TableWithJoins
UnresolvedDatabaseName
A name of a database
UnresolvedItemName
A name of a table, view, custom type, etc. that lives in a schema, possibly multi-part, i.e. db.schema.obj
UnresolvedSchemaName
A name of a schema
UpdateStatement
UPDATE
ValidateConnectionStatement
VALIDATE CONNECTION
ValueError
Values
Version
ViewDefinition
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.)) Includes potential IGNORE NULLS or RESPECT NULLS from before the OVER clause.

Enums§

AbbreviatedGrantOrRevokeStatement
AlterClusterAction
AlterConnectionAction
AlterConnectionOptionName
AlterIndexAction
AlterRoleOption
ALTER ROLE ... [ WITH | SET ] ...
AlterSinkAction
AlterSourceAction
AlterSourceAddSubsourceOptionName
AsOf
AvroSchema
AvroSchemaOptionName
CatalogName
ClusterAlterOptionName
ClusterAlterOptionValue
ClusterAlterUntilReadyOptionName
ClusterFeatureName
ClusterOptionName
ClusterScheduleOptionValue
ColumnOption
ColumnOptions are modifiers that follow a column definition in a CREATE TABLE statement.
ColumnVersioned
CommentObjectType
ConnectionOptionName
ContinualTaskOptionName
ContinualTaskStmt
CopyDirection
CopyOptionName
CopyRelation
CopyTarget
CreateConnectionOptionName
CreateConnectionType
CreateContinualTaskSugar
CreateSinkConnection
CreateSinkOptionName
An option in a CREATE SINK statement.
CreateSourceConnection
CreateSourceOptionName
CreateSubsourceOptionName
An option in a CREATE SUBSOURCE statement.
CreateTypeAs
CREATE TYPE .. AS <TYPE>
CreateTypeListOptionName
CreateTypeMapOptionName
CsrConfigOptionName
CsvColumns
CteBlock
A block of common table expressions (CTEs).
DateTimeField
DeferredItemName
DiscardTarget
Distinct
DocOnIdentifier
DocOnSchema
ExplainAnalyzeComputationProperty
ExplainAnalyzeProperty
ExplainFormat
ExplainPlanOptionName
ExplainSinkSchemaFor
ExplainStage
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.
ExternalReferences
Specifies which set of external references to generate a source export for in a CREATE SOURCE statement.
FetchDirection
FetchOptionName
Format
FormatSpecifier
FunctionArgs
Arguments for a function call.
GrantTargetAllSpecification
GrantTargetSpecification
GrantTargetSpecificationInner
HomogenizingFunction
IdentError
IfExistsBehavior
IndexOptionName
An option in a CREATE CLUSTER statement.
InsertSource
IsExprConstruct
JoinConstraint
JoinOperator
KafkaBrokerAwsPrivatelinkOptionName
KafkaBrokerTunnel
KafkaSinkConfigOptionName
KafkaSourceConfigOptionName
KeyConstraint
A key constraint, specified in a CREATE SOURCE.
LoadGenerator
LoadGeneratorOptionName
MaterializedViewOptionName
MutRecBlockOptionName
MySqlConfigOptionName
NamedPlan
An enum of named plans that identifies specific stages in an optimizer trace where these plans can be found.
NetworkPolicyOptionName
NetworkPolicyRuleOptionName
NoticeSeverity
ObjectType
PgConfigOptionName
Privilege
PrivilegeSpecification
ProtobufSchema
RawClusterName
RawDataType
SQL data types
RawItemName
RawNetworkPolicyName
ReaderSchemaSelectionStrategy
RefreshOptionValue
ReplicaOptionName
RoleAttribute
Attributes that can be attached to roles.
SelectItem
One item of the comma-separated list following SELECT
SelectOptionName
SetExpr
A node in a tree, representing a “query body” expression, roughly: SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]
SetOperator
SetRoleVar
ALTER ROLE role_name [SET | RESET] ...
SetVariableTo
SetVariableValue
ShowObjectType
ShowStatement
ShowStatementFilter
SinkEnvelope
SourceEnvelope
SourceErrorPolicy
SourceIncludeMetadata
SqlServerConfigOptionName
Statement
A top-level statement (SELECT, INSERT, CREATE, etc.)
StatementKind
SubscribeOptionName
SubscribeOutput
SubscribeRelation
SystemObjectType
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
TableFromSourceColumns
CREATE TABLE .. FROM SOURCE columns specification can have 3 states: Before purification they can be NotSpecified or Named 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.
TableFromSourceOptionName
TableOptionName
TargetRoleSpecification
TransactionAccessMode
TransactionIsolationLevel
TransactionMode
UnresolvedObjectName
Value
Primitive SQL values.
WindowFrameBound
Specifies WindowFrame’s start_bound and end_bound
WindowFrameUnits
WithOptionValue

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