pub enum Statement {
Show 127 variants
Analyze(Analyze),
Set(Set),
Truncate(Truncate),
Msck(Msck),
Query(Box<Query>),
Insert(Insert),
Install {
extension_name: Ident,
},
Load {
extension_name: Ident,
},
Directory {
overwrite: bool,
local: bool,
path: String,
file_format: Option<FileFormat>,
source: Box<Query>,
},
Case(CaseStatement),
If(IfStatement),
While(WhileStatement),
Raise(RaiseStatement),
Call(Function),
Copy {
source: CopySource,
to: bool,
target: CopyTarget,
options: Vec<CopyOption>,
legacy_options: Vec<CopyLegacyOption>,
values: Vec<Option<String>>,
},
CopyIntoSnowflake {Show 14 fields
kind: CopyIntoSnowflakeKind,
into: ObjectName,
into_columns: Option<Vec<Ident>>,
from_obj: Option<ObjectName>,
from_obj_alias: Option<Ident>,
stage_params: StageParamsObject,
from_transformations: Option<Vec<StageLoadSelectItemKind>>,
from_query: Option<Box<Query>>,
files: Option<Vec<String>>,
pattern: Option<String>,
file_format: KeyValueOptions,
copy_options: KeyValueOptions,
validation_mode: Option<String>,
partition: Option<Box<Expr>>,
},
Open(OpenStatement),
Close {
cursor: CloseCursor,
},
Update(Update),
Delete(Delete),
CreateView(CreateView),
CreateTable(CreateTable),
CreateVirtualTable {
name: ObjectName,
if_not_exists: bool,
module_name: Ident,
module_args: Vec<Ident>,
},
CreateIndex(CreateIndex),
CreateRole(CreateRole),
CreateSecret {
or_replace: bool,
temporary: Option<bool>,
if_not_exists: bool,
name: Option<Ident>,
storage_specifier: Option<Ident>,
secret_type: Ident,
options: Vec<SecretOption>,
},
CreateServer(CreateServerStatement),
CreatePolicy(CreatePolicy),
CreateConnector(CreateConnector),
CreateOperator(CreateOperator),
CreateOperatorFamily(CreateOperatorFamily),
CreateOperatorClass(CreateOperatorClass),
AlterTable(AlterTable),
AlterSchema(AlterSchema),
AlterIndex {
name: ObjectName,
operation: AlterIndexOperation,
},
AlterView {
name: ObjectName,
columns: Vec<Ident>,
query: Box<Query>,
with_options: Vec<SqlOption>,
},
AlterType(AlterType),
AlterOperator(AlterOperator),
AlterOperatorFamily(AlterOperatorFamily),
AlterOperatorClass(AlterOperatorClass),
AlterRole {
name: Ident,
operation: AlterRoleOperation,
},
AlterPolicy(AlterPolicy),
AlterConnector {
name: Ident,
properties: Option<Vec<SqlOption>>,
url: Option<String>,
owner: Option<AlterConnectorOwner>,
},
AlterSession {
set: bool,
session_params: KeyValueOptions,
},
AttachDatabase {
schema_name: Ident,
database_file_name: Expr,
database: bool,
},
AttachDuckDBDatabase {
if_not_exists: bool,
database: bool,
database_path: Ident,
database_alias: Option<Ident>,
attach_options: Vec<AttachDuckDBDatabaseOption>,
},
DetachDuckDBDatabase {
if_exists: bool,
database: bool,
database_alias: Ident,
},
Drop {
object_type: ObjectType,
if_exists: bool,
names: Vec<ObjectName>,
cascade: bool,
restrict: bool,
purge: bool,
temporary: bool,
table: Option<ObjectName>,
},
DropFunction(DropFunction),
DropDomain(DropDomain),
DropProcedure {
if_exists: bool,
proc_desc: Vec<FunctionDesc>,
drop_behavior: Option<DropBehavior>,
},
DropSecret {
if_exists: bool,
temporary: Option<bool>,
name: Ident,
storage_specifier: Option<Ident>,
},
DropPolicy(DropPolicy),
DropConnector {
if_exists: bool,
name: Ident,
},
Declare {
stmts: Vec<Declare>,
},
CreateExtension(CreateExtension),
DropExtension(DropExtension),
DropOperator(DropOperator),
DropOperatorFamily(DropOperatorFamily),
DropOperatorClass(DropOperatorClass),
Fetch {
name: Ident,
direction: FetchDirection,
position: FetchPosition,
into: Option<ObjectName>,
},
Flush {
object_type: FlushType,
location: Option<FlushLocation>,
channel: Option<String>,
read_lock: bool,
export: bool,
tables: Vec<ObjectName>,
},
Discard {
object_type: DiscardObject,
},
ShowFunctions {
filter: Option<ShowStatementFilter>,
},
ShowVariable {
variable: Vec<Ident>,
},
ShowStatus {
filter: Option<ShowStatementFilter>,
global: bool,
session: bool,
},
ShowVariables {
filter: Option<ShowStatementFilter>,
global: bool,
session: bool,
},
ShowCreate {
obj_type: ShowCreateObject,
obj_name: ObjectName,
},
ShowColumns {
extended: bool,
full: bool,
show_options: ShowStatementOptions,
},
ShowDatabases {
terse: bool,
history: bool,
show_options: ShowStatementOptions,
},
ShowSchemas {
terse: bool,
history: bool,
show_options: ShowStatementOptions,
},
ShowCharset(ShowCharset),
ShowObjects(ShowObjects),
ShowTables {
terse: bool,
history: bool,
extended: bool,
full: bool,
external: bool,
show_options: ShowStatementOptions,
},
ShowViews {
terse: bool,
materialized: bool,
show_options: ShowStatementOptions,
},
ShowCollation {
filter: Option<ShowStatementFilter>,
},
Use(Use),
StartTransaction {
modes: Vec<TransactionMode>,
begin: bool,
transaction: Option<BeginTransactionKind>,
modifier: Option<TransactionModifier>,
statements: Vec<Statement>,
exception: Option<Vec<ExceptionWhen>>,
has_end_keyword: bool,
},
Comment {
object_type: CommentObject,
object_name: ObjectName,
comment: Option<String>,
if_exists: bool,
},
Commit {
chain: bool,
end: bool,
modifier: Option<TransactionModifier>,
},
Rollback {
chain: bool,
savepoint: Option<Ident>,
},
CreateSchema {
schema_name: SchemaName,
if_not_exists: bool,
with: Option<Vec<SqlOption>>,
options: Option<Vec<SqlOption>>,
default_collate_spec: Option<Expr>,
clone: Option<ObjectName>,
},
CreateDatabase {Show 22 fields
db_name: ObjectName,
if_not_exists: bool,
location: Option<String>,
managed_location: Option<String>,
or_replace: bool,
transient: bool,
clone: Option<ObjectName>,
data_retention_time_in_days: Option<u64>,
max_data_extension_time_in_days: Option<u64>,
external_volume: Option<String>,
catalog: Option<String>,
replace_invalid_characters: Option<bool>,
default_ddl_collation: Option<String>,
storage_serialization_policy: Option<StorageSerializationPolicy>,
comment: Option<String>,
default_charset: Option<String>,
default_collation: Option<String>,
catalog_sync: Option<String>,
catalog_sync_namespace_mode: Option<CatalogSyncNamespaceMode>,
catalog_sync_namespace_flatten_delimiter: Option<String>,
with_tags: Option<Vec<Tag>>,
with_contacts: Option<Vec<ContactEntry>>,
},
CreateFunction(CreateFunction),
CreateTrigger(CreateTrigger),
DropTrigger(DropTrigger),
CreateProcedure {
or_alter: bool,
name: ObjectName,
params: Option<Vec<ProcedureParam>>,
language: Option<Ident>,
body: ConditionalStatements,
},
CreateMacro {
or_replace: bool,
temporary: bool,
name: ObjectName,
args: Option<Vec<MacroArg>>,
definition: MacroDefinition,
},
CreateStage {
or_replace: bool,
temporary: bool,
if_not_exists: bool,
name: ObjectName,
stage_params: StageParamsObject,
directory_table_params: KeyValueOptions,
file_format: KeyValueOptions,
copy_options: KeyValueOptions,
comment: Option<String>,
},
Assert {
condition: Expr,
message: Option<Expr>,
},
Grant(Grant),
Deny(DenyStatement),
Revoke(Revoke),
Deallocate {
name: Ident,
prepare: bool,
},
Execute {
name: Option<ObjectName>,
parameters: Vec<Expr>,
has_parentheses: bool,
immediate: bool,
into: Vec<Ident>,
using: Vec<ExprWithAlias>,
output: bool,
default: bool,
},
Prepare {
name: Ident,
data_types: Vec<DataType>,
statement: Box<Statement>,
},
Kill {
modifier: Option<KillType>,
id: u64,
},
ExplainTable {
describe_alias: DescribeAlias,
hive_format: Option<HiveDescribeFormat>,
has_table_keyword: bool,
table_name: ObjectName,
},
Explain {
describe_alias: DescribeAlias,
analyze: bool,
verbose: bool,
query_plan: bool,
estimate: bool,
statement: Box<Statement>,
format: Option<AnalyzeFormatKind>,
options: Option<Vec<UtilityOption>>,
},
Savepoint {
name: Ident,
},
ReleaseSavepoint {
name: Ident,
},
Merge(Merge),
Cache {
table_flag: Option<ObjectName>,
table_name: ObjectName,
has_as: bool,
options: Vec<SqlOption>,
query: Option<Box<Query>>,
},
UNCache {
table_name: ObjectName,
if_exists: bool,
},
CreateSequence {
temporary: bool,
if_not_exists: bool,
name: ObjectName,
data_type: Option<DataType>,
sequence_options: Vec<SequenceOptions>,
owned_by: Option<ObjectName>,
},
CreateDomain(CreateDomain),
CreateType {
name: ObjectName,
representation: Option<UserDefinedTypeRepresentation>,
},
Pragma {
name: ObjectName,
value: Option<Value>,
is_eq: bool,
},
LockTables {
tables: Vec<LockTable>,
},
UnlockTables,
Unload {
query: Option<Box<Query>>,
query_text: Option<String>,
to: Ident,
auth: Option<IamRoleKind>,
with: Vec<SqlOption>,
options: Vec<CopyLegacyOption>,
},
OptimizeTable {
name: ObjectName,
on_cluster: Option<Ident>,
partition: Option<Partition>,
include_final: bool,
deduplicate: Option<Deduplicate>,
},
LISTEN {
channel: Ident,
},
UNLISTEN {
channel: Ident,
},
NOTIFY {
channel: Ident,
payload: Option<String>,
},
LoadData {
local: bool,
inpath: String,
overwrite: bool,
table_name: ObjectName,
partitioned: Option<Vec<Expr>>,
table_format: Option<HiveLoadDataFormat>,
},
RenameTable(Vec<RenameTable>),
List(FileStagingCommand),
Remove(FileStagingCommand),
RaisError {
message: Box<Expr>,
severity: Box<Expr>,
state: Box<Expr>,
arguments: Vec<Expr>,
options: Vec<RaisErrorOption>,
},
Print(PrintStatement),
Return(ReturnStatement),
ExportData(ExportData),
CreateUser(CreateUser),
AlterUser(AlterUser),
Vacuum(VacuumStatement),
Reset(ResetStatement),
}Expand description
A top-level statement (SELECT, INSERT, CREATE, etc.)
Variants§
Analyze(Analyze)
ANALYZEAnalyze (Hive)
Set(Set)
SET statements (session, transaction, timezone, etc.).
Truncate(Truncate)
TRUNCATETruncate (Hive)
Msck(Msck)
MSCKMsck (Hive)
Query(Box<Query>)
SELECTInsert(Insert)
INSERTInstall
INSTALLLoad
LOADDirectory
LOAD DATA from a directory or query source.
Fields
file_format: Option<FileFormat>Optional file format for the data.
Case(CaseStatement)
A CASE statement.
If(IfStatement)
An IF statement.
While(WhileStatement)
A WHILE statement.
Raise(RaiseStatement)
A RAISE statement.
Call(Function)
CALL <function>Copy
COPY [TO | FROM] ...Fields
source: CopySourceThe source of ‘COPY TO’, or the target of ‘COPY FROM’
target: CopyTargetThe target of ‘COPY TO’, or the source of ‘COPY FROM’
options: Vec<CopyOption>WITH options (from PostgreSQL version 9.0)
legacy_options: Vec<CopyLegacyOption>WITH options (before PostgreSQL version 9.0)
CopyIntoSnowflake
COPY INTO <table> | <location>See: https://docs.snowflake.com/en/sql-reference/sql/copy-into-table https://docs.snowflake.com/en/sql-reference/sql/copy-into-location
Copy Into syntax available for Snowflake is different than the one implemented in Postgres. Although they share common prefix, it is reasonable to implement them in different enums. This can be refactored later once custom dialects are allowed to have custom Statements.
Fields
kind: CopyIntoSnowflakeKindKind of COPY INTO operation (table or location).
into: ObjectNameTarget object for the COPY INTO operation.
from_obj: Option<ObjectName>Optional source object name (staged data).
stage_params: StageParamsObjectStage-specific parameters (e.g., credentials, path).
from_transformations: Option<Vec<StageLoadSelectItemKind>>Optional list of transformations applied when loading.
file_format: KeyValueOptionsFile format options.
copy_options: KeyValueOptionsAdditional copy options.
Open(OpenStatement)
OPEN cursor_nameOpens a cursor.
Close
CLOSECloses the portal underlying an open cursor.
Fields
cursor: CloseCursorCursor name
Update(Update)
UPDATEDelete(Delete)
DELETECreateView(CreateView)
CREATE VIEWCreateTable(CreateTable)
CREATE TABLECreateVirtualTable
CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)`Sqlite specific statement
Fields
name: ObjectNameName of the virtual table module instance.
CreateIndex(CreateIndex)
`CREATE INDEX`CreateRole(CreateRole)
CREATE ROLESee PostgreSQL
CreateSecret
CREATE SECRETSee DuckDB
Fields
options: Vec<SecretOption>Additional secret options.
CreateServer(CreateServerStatement)
A CREATE SERVER statement.
CreatePolicy(CreatePolicy)
CREATE POLICYSee PostgreSQL
CreateConnector(CreateConnector)
CREATE CONNECTORSee Hive
CreateOperator(CreateOperator)
CREATE OPERATORSee PostgreSQL
CreateOperatorFamily(CreateOperatorFamily)
CREATE OPERATOR FAMILYSee PostgreSQL
CreateOperatorClass(CreateOperatorClass)
CREATE OPERATOR CLASSSee PostgreSQL
AlterTable(AlterTable)
ALTER TABLEAlterSchema(AlterSchema)
ALTER SCHEMASee BigQuery
AlterIndex
ALTER INDEXFields
name: ObjectNameName of the index to alter.
operation: AlterIndexOperationThe operation to perform on the index.
AlterView
ALTER VIEWFields
name: ObjectNameView name being altered.
AlterType(AlterType)
ALTER TYPE
See [PostgreSQL](https://www.postgresql.org/docs/current/sql-altertype.html)AlterOperator(AlterOperator)
ALTER OPERATORSee PostgreSQL
AlterOperatorFamily(AlterOperatorFamily)
ALTER OPERATOR FAMILYSee PostgreSQL
AlterOperatorClass(AlterOperatorClass)
ALTER OPERATOR CLASSSee PostgreSQL
AlterRole
ALTER ROLEFields
operation: AlterRoleOperationOperation to perform on the role.
AlterPolicy(AlterPolicy)
ALTER POLICY <NAME> ON <TABLE NAME> [<OPERATION>](Postgresql-specific)
AlterConnector
ALTER CONNECTOR connector_name SET DCPROPERTIES(property_name=property_value, ...);
or
ALTER CONNECTOR connector_name SET URL new_url;
or
ALTER CONNECTOR connector_name SET OWNER [USER|ROLE] user_or_role;(Hive-specific)
Fields
owner: Option<AlterConnectorOwner>Optional new owner specification.
AlterSession
ALTER SESSION SET sessionParam
ALTER SESSION UNSET <param_name> [ , <param_name> , ... ]See https://docs.snowflake.com/en/sql-reference/sql/alter-session
Fields
session_params: KeyValueOptionsThe session parameters to set or unset
AttachDatabase
ATTACH DATABASE 'path/to/file' AS alias(SQLite-specific)
Fields
AttachDuckDBDatabase
(DuckDB-specific)
ATTACH 'sqlite_file.db' AS sqlite_db (READ_ONLY, TYPE SQLITE);Fields
attach_options: Vec<AttachDuckDBDatabaseOption>Dialect-specific attach options (e.g., READ_ONLY).
DetachDuckDBDatabase
Fields
Drop
DROP [TABLE, VIEW, ...]Fields
object_type: ObjectTypeThe type of the object to drop: TABLE, VIEW, etc.
names: Vec<ObjectName>One or more objects to drop. (ANSI SQL requires exactly one.)
cascade: boolWhether CASCADE was specified. This will be false when
RESTRICT or no drop behavior at all was specified.
restrict: boolWhether RESTRICT was specified. This will be false when
CASCADE or no drop behavior at all was specified.
purge: boolHive allows you specify whether the table’s stored data will be deleted along with the dropped table
table: Option<ObjectName>MySQL-specific drop index syntax, which requires table specification See https://dev.mysql.com/doc/refman/8.4/en/drop-index.html
DropFunction(DropFunction)
DROP FUNCTIONDropDomain(DropDomain)
DropProcedure
DROP PROCEDUREFields
proc_desc: Vec<FunctionDesc>One or more functions/procedures to drop.
drop_behavior: Option<DropBehavior>Optional drop behavior (CASCADE or RESTRICT).
DropSecret
DROP SECRETFields
DropPolicy(DropPolicy)
DROP POLICYSee PostgreSQL
DropConnector
DROP CONNECTORSee Hive
Declare
DECLAREDeclare Cursor Variables
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
CreateExtension(CreateExtension)
CREATE EXTENSION [ IF NOT EXISTS ] extension_name
[ WITH ] [ SCHEMA schema_name ]
[ VERSION version ]
[ CASCADE ]Note: this is a PostgreSQL-specific statement,
DropExtension(DropExtension)
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]Note: this is a PostgreSQL-specific statement. https://www.postgresql.org/docs/current/sql-dropextension.html
DropOperator(DropOperator)
DROP OPERATOR [ IF EXISTS ] name ( { left_type | NONE } , right_type ) [, ...] [ CASCADE | RESTRICT ]Note: this is a PostgreSQL-specific statement. https://www.postgresql.org/docs/current/sql-dropoperator.html
DropOperatorFamily(DropOperatorFamily)
DROP OPERATOR FAMILY [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]Note: this is a PostgreSQL-specific statement. https://www.postgresql.org/docs/current/sql-dropopfamily.html
DropOperatorClass(DropOperatorClass)
DROP OPERATOR CLASS [ IF EXISTS ] name USING index_method [ CASCADE | RESTRICT ]Note: this is a PostgreSQL-specific statement. https://www.postgresql.org/docs/current/sql-dropopclass.html
Fetch
FETCHRetrieve rows from a query using a cursor
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
Fields
direction: FetchDirectionThe fetch direction (e.g., FORWARD, BACKWARD).
position: FetchPositionThe fetch position (e.g., ALL, NEXT, ABSOLUTE).
into: Option<ObjectName>Optional target table to fetch rows into.
Flush
FLUSH [NO_WRITE_TO_BINLOG | LOCAL] flush_option [, flush_option] ... | tables_optionNote: this is a Mysql-specific statement, but may also compatible with other SQL.
Fields
location: Option<FlushLocation>Optional flush location (dialect-specific).
tables: Vec<ObjectName>Optional list of tables involved in the flush.
Discard
DISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ]Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
Fields
object_type: DiscardObjectThe kind of object(s) to discard (ALL, PLANS, etc.).
ShowFunctions
SHOW FUNCTIONS
Note: this is a Presto-specific statement.
Fields
filter: Option<ShowStatementFilter>Optional filter for which functions to display.
ShowVariable
SHOW <variable>Note: this is a PostgreSQL-specific statement.
ShowStatus
SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern' | WHERE expr]Note: this is a MySQL-specific statement.
Fields
filter: Option<ShowStatementFilter>Optional filter for which status entries to display.
ShowVariables
SHOW VARIABLESNote: this is a MySQL-specific statement.
Fields
filter: Option<ShowStatementFilter>Optional filter for which variables to display.
ShowCreate
SHOW CREATE TABLENote: this is a MySQL-specific statement.
Fields
obj_type: ShowCreateObjectThe kind of object being shown (TABLE, VIEW, etc.).
obj_name: ObjectNameThe name of the object to show create statement for.
ShowColumns
SHOW COLUMNSFields
show_options: ShowStatementOptionsAdditional options for SHOW COLUMNS.
ShowDatabases
SHOW DATABASESFields
show_options: ShowStatementOptionsAdditional options for SHOW DATABASES.
ShowSchemas
SHOW SCHEMASFields
show_options: ShowStatementOptionsAdditional options for SHOW SCHEMAS.
ShowCharset(ShowCharset)
Show the available character sets (alias CHARSET).
ShowObjects(ShowObjects)
SHOW OBJECTS LIKE 'line%' IN mydb.publicSnowflake-specific statement https://docs.snowflake.com/en/sql-reference/sql/show-objects
ShowTables
SHOW TABLESFields
show_options: ShowStatementOptionsAdditional options for SHOW statements.
ShowViews
SHOW VIEWSFields
show_options: ShowStatementOptionsAdditional options for SHOW statements.
ShowCollation
SHOW COLLATIONNote: this is a MySQL-specific statement.
Fields
filter: Option<ShowStatementFilter>Optional filter for which collations to display.
Use(Use)
`USE ...`StartTransaction
START [ TRANSACTION | WORK ] | START TRANSACTION } ...If begin is false.
`BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...`If begin is true
Fields
modes: Vec<TransactionMode>Transaction modes such as ISOLATION LEVEL or READ WRITE.
transaction: Option<BeginTransactionKind>Optional specific keyword used: TRANSACTION or WORK.
modifier: Option<TransactionModifier>Optional transaction modifier (e.g., AND NO CHAIN).
statements: Vec<Statement>List of statements belonging to the BEGIN block.
Example:
BEGIN
SELECT 1;
SELECT 2;
END;exception: Option<Vec<ExceptionWhen>>Exception handling with exception clauses. Example:
EXCEPTION
WHEN EXCEPTION_1 THEN
SELECT 2;
WHEN EXCEPTION_2 OR EXCEPTION_3 THEN
SELECT 3;
WHEN OTHER THEN
SELECT 4;https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#beginexceptionend https://docs.snowflake.com/en/sql-reference/snowflake-scripting/exception
Comment
COMMENT ON ...Note: this is a PostgreSQL-specific statement.
Fields
object_type: CommentObjectType of object being commented (table, column, etc.).
object_name: ObjectNameName of the object the comment applies to.
if_exists: boolAn optional IF EXISTS clause. (Non-standard.)
See https://docs.snowflake.com/en/sql-reference/sql/comment
Commit
COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ]If end is false
END [ TRY | CATCH ]If end is true
Fields
modifier: Option<TransactionModifier>Optional transaction modifier for commit semantics.
Rollback
ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] [ TO [ SAVEPOINT ] savepoint_name ]Fields
CreateSchema
CREATE SCHEMAFields
schema_name: SchemaName<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>
default_collate_spec: Option<Expr>Default collation specification for the schema.
CREATE SCHEMA myschema DEFAULT COLLATE 'und:ci';clone: Option<ObjectName>CreateDatabase
CREATE DATABASESee: https://docs.snowflake.com/en/sql-reference/sql/create-database
Fields
db_name: ObjectNameDatabase name.
clone: Option<ObjectName>Optional clone source.
storage_serialization_policy: Option<StorageSerializationPolicy>Storage serialization policy.
catalog_sync_namespace_mode: Option<CatalogSyncNamespaceMode>Catalog sync namespace mode.
catalog_sync_namespace_flatten_delimiter: Option<String>Optional flatten delimiter for namespace sync.
Optional tags for the database.
with_contacts: Option<Vec<ContactEntry>>Optional contact entries for the database.
CreateFunction(CreateFunction)
CreateTrigger(CreateTrigger)
CREATE TRIGGER statement. See struct CreateTrigger for details.
DropTrigger(DropTrigger)
DROP TRIGGER statement. See struct DropTrigger for details.
CreateProcedure
CREATE PROCEDUREFields
name: ObjectNameProcedure name.
params: Option<Vec<ProcedureParam>>Optional procedure parameters.
body: ConditionalStatementsProcedure body statements.
CreateMacro
CreateStage
CREATE STAGESee https://docs.snowflake.com/en/sql-reference/sql/create-stage
Fields
name: ObjectNameStage name.
stage_params: StageParamsObjectStage parameters.
directory_table_params: KeyValueOptionsDirectory table parameters.
file_format: KeyValueOptionsFile format options.
copy_options: KeyValueOptionsCopy options for stage.
Assert
ASSERT <condition> [AS <message>]Fields
Grant(Grant)
GRANT privileges ON objects TO granteesDeny(DenyStatement)
DENY privileges ON object TO granteesRevoke(Revoke)
REVOKE privileges ON objects FROM granteesDeallocate
DEALLOCATE [ PREPARE ] { name | ALL }Note: this is a PostgreSQL-specific statement.
Execute
An `EXECUTE` statementPostgres: https://www.postgresql.org/docs/current/sql-execute.html MSSQL: https://learn.microsoft.com/en-us/sql/relational-databases/stored-procedures/execute-a-stored-procedure BigQuery: https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#execute_immediate Snowflake: https://docs.snowflake.com/en/sql-reference/sql/execute-immediate
Fields
name: Option<ObjectName>Optional function/procedure name.
using: Vec<ExprWithAlias>USING expressions with optional aliases.
output: boolWhether the last parameter is the return value of the procedure MSSQL: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/execute-transact-sql?view=sql-server-ver17#output
default: boolWhether to invoke the procedure with the default parameter values MSSQL: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/execute-transact-sql?view=sql-server-ver17#default
Prepare
PREPARE name [ ( data_type [, ...] ) ] AS statementNote: this is a PostgreSQL-specific statement.
Fields
Kill
KILL [CONNECTION | QUERY | MUTATION]See https://clickhouse.com/docs/en/sql-reference/statements/kill/ See https://dev.mysql.com/doc/refman/8.0/en/kill.html
Fields
ExplainTable
[EXPLAIN | DESC | DESCRIBE] TABLENote: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/explain.html
Fields
describe_alias: DescribeAliasEXPLAIN | DESC | DESCRIBE
hive_format: Option<HiveDescribeFormat>Hive style FORMATTED | EXTENDED
table_name: ObjectNameTable name
Explain
[EXPLAIN | DESC | DESCRIBE] <statement>Fields
describe_alias: DescribeAliasEXPLAIN | DESC | DESCRIBE
estimate: boolEXPLAIN ESTIMATE
Clickhouse
format: Option<AnalyzeFormatKind>Optional output format of explain
options: Option<Vec<UtilityOption>>Postgres style utility options, (analyze, verbose true)
Savepoint
SAVEPOINTDefine a new savepoint within the current transaction
ReleaseSavepoint
RELEASE [ SAVEPOINT ] savepoint_nameMerge(Merge)
A MERGE statement.
MERGE INTO <target_table> USING <source> ON <join_expr> { matchedClause | notMatchedClause } [ ... ]Cache
CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]See Spark SQL docs for more details.
UNCache
UNCACHE TABLE [ IF EXISTS ] <table_name>CreateSequence
CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>Define a new sequence:
Fields
name: ObjectNameSequence name.
sequence_options: Vec<SequenceOptions>Sequence options (INCREMENT, MINVALUE, etc.).
owned_by: Option<ObjectName>Optional OWNED BY target.
CreateDomain(CreateDomain)
A CREATE DOMAIN statement.
CreateType
CREATE TYPE <name>Fields
name: ObjectNameType name to create.
representation: Option<UserDefinedTypeRepresentation>Optional type representation details.
Pragma
PRAGMA <schema-name>.<pragma-name> = <pragma-value>Fields
name: ObjectNamePragma name (possibly qualified).
LockTables
LOCK TABLES <table_name> [READ [LOCAL] | [LOW_PRIORITY] WRITE]Note: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html
UnlockTables
UNLOCK TABLESNote: this is a MySQL-specific statement. See https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html
Unload
Unloads the result of a query to file
UNLOAD(statement) TO <destination> [ WITH options ]UNLOAD('statement') TO <destination> [ OPTIONS ]Fields
auth: Option<IamRoleKind>Optional IAM role/auth information.
options: Vec<CopyLegacyOption>Legacy copy-style options.
OptimizeTable
OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE [BY expression]]See ClickHouse https://clickhouse.com/docs/en/sql-reference/statements/optimize
Fields
name: ObjectNameTable name to optimize.
deduplicate: Option<Deduplicate>Optional deduplication settings.
LISTEN
LISTENlisten for a notification channel
See Postgres https://www.postgresql.org/docs/current/sql-listen.html
UNLISTEN
UNLISTENstop listening for a notification
See Postgres https://www.postgresql.org/docs/current/sql-unlisten.html
NOTIFY
NOTIFY channel [ , payload ]send a notification event together with an optional “payload” string to channel
See Postgres https://www.postgresql.org/docs/current/sql-notify.html
Fields
LoadData
LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename
[PARTITION (partcol1=val1, partcol2=val2 ...)]
[INPUTFORMAT 'inputformat' SERDE 'serde']Loading files into tables
Fields
table_name: ObjectNameTarget table name to load into.
table_format: Option<HiveLoadDataFormat>Optional table format information.
RenameTable(Vec<RenameTable>)
Rename TABLE tbl_name TO new_tbl_name[, tbl_name2 TO new_tbl_name2] ...Renames one or more tables
See Mysql https://dev.mysql.com/doc/refman/9.1/en/rename-table.html
List(FileStagingCommand)
Snowflake LIST
See: https://docs.snowflake.com/en/sql-reference/sql/list
Remove(FileStagingCommand)
Snowflake REMOVE
See: https://docs.snowflake.com/en/sql-reference/sql/remove
RaisError
RaiseError (MSSQL) RAISERROR ( { msg_id | msg_str | @local_variable } { , severity , state } [ , argument [ , …n ] ] ) [ WITH option [ , …n ] ] See https://learn.microsoft.com/en-us/sql/t-sql/language-elements/raiserror-transact-sql?view=sql-server-ver16
Fields
options: Vec<RaisErrorOption>Additional WITH options for RAISERROR.
Print(PrintStatement)
PRINT msg_str | @local_variable | string_exprSee: https://learn.microsoft.com/en-us/sql/t-sql/statements/print-transact-sql
Return(ReturnStatement)
RETURN [ expression ]See ReturnStatement
ExportData(ExportData)
Export data statement
Example:
EXPORT DATA OPTIONS(uri='gs://bucket/folder/*', format='PARQUET', overwrite=true) AS
SELECT field1, field2 FROM mydataset.table1 ORDER BY field1 LIMIT 10CreateUser(CreateUser)
CREATE [OR REPLACE] USER <user> [IF NOT EXISTS]AlterUser(AlterUser)
ALTER USER \[ IF EXISTS \] \[ <name> \]Vacuum(VacuumStatement)
Re-sorts rows and reclaims space in either a specified table or all tables in the current database
VACUUM tblReset(ResetStatement)
Restore the value of a run-time parameter to the default value.
RESET configuration_parameter;
RESET ALL;Trait Implementations§
Source§impl Display for Statement
impl Display for Statement
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Formats a SQL statement with support for pretty printing.
When using the alternate flag ({:#}), the statement will be formatted with proper
indentation and line breaks. For example:
let sql = "SELECT a, b FROM table_1";
let ast = Parser::parse_sql(&GenericDialect, sql).unwrap();
// Regular formatting
assert_eq!(format!("{}", ast[0]), "SELECT a, b FROM table_1");
// Pretty printing
assert_eq!(format!("{:#}", ast[0]),
r#"SELECT
a,
b
FROM
table_1"#);Source§impl From<AlterOperator> for Statement
impl From<AlterOperator> for Statement
Source§fn from(a: AlterOperator) -> Statement
fn from(a: AlterOperator) -> Statement
Source§impl From<AlterOperatorClass> for Statement
impl From<AlterOperatorClass> for Statement
Source§fn from(a: AlterOperatorClass) -> Statement
fn from(a: AlterOperatorClass) -> Statement
Source§impl From<AlterOperatorFamily> for Statement
impl From<AlterOperatorFamily> for Statement
Source§fn from(a: AlterOperatorFamily) -> Statement
fn from(a: AlterOperatorFamily) -> Statement
Source§impl From<AlterPolicy> for Statement
impl From<AlterPolicy> for Statement
Source§fn from(v: AlterPolicy) -> Statement
fn from(v: AlterPolicy) -> Statement
Source§impl From<AlterSchema> for Statement
impl From<AlterSchema> for Statement
Source§fn from(a: AlterSchema) -> Statement
fn from(a: AlterSchema) -> Statement
Source§impl From<AlterTable> for Statement
impl From<AlterTable> for Statement
Source§fn from(at: AlterTable) -> Statement
fn from(at: AlterTable) -> Statement
Source§impl From<CaseStatement> for Statement
impl From<CaseStatement> for Statement
Source§fn from(c: CaseStatement) -> Statement
fn from(c: CaseStatement) -> Statement
Source§impl From<CreateConnector> for Statement
impl From<CreateConnector> for Statement
Source§fn from(c: CreateConnector) -> Statement
fn from(c: CreateConnector) -> Statement
Source§impl From<CreateDomain> for Statement
impl From<CreateDomain> for Statement
Source§fn from(c: CreateDomain) -> Statement
fn from(c: CreateDomain) -> Statement
Source§impl From<CreateExtension> for Statement
impl From<CreateExtension> for Statement
Source§fn from(ce: CreateExtension) -> Statement
fn from(ce: CreateExtension) -> Statement
Source§impl From<CreateFunction> for Statement
impl From<CreateFunction> for Statement
Source§fn from(c: CreateFunction) -> Statement
fn from(c: CreateFunction) -> Statement
Source§impl From<CreateIndex> for Statement
impl From<CreateIndex> for Statement
Source§fn from(c: CreateIndex) -> Statement
fn from(c: CreateIndex) -> Statement
Source§impl From<CreateOperator> for Statement
impl From<CreateOperator> for Statement
Source§fn from(c: CreateOperator) -> Statement
fn from(c: CreateOperator) -> Statement
Source§impl From<CreateOperatorClass> for Statement
impl From<CreateOperatorClass> for Statement
Source§fn from(c: CreateOperatorClass) -> Statement
fn from(c: CreateOperatorClass) -> Statement
Source§impl From<CreateOperatorFamily> for Statement
impl From<CreateOperatorFamily> for Statement
Source§fn from(c: CreateOperatorFamily) -> Statement
fn from(c: CreateOperatorFamily) -> Statement
Source§impl From<CreatePolicy> for Statement
impl From<CreatePolicy> for Statement
Source§fn from(v: CreatePolicy) -> Statement
fn from(v: CreatePolicy) -> Statement
Source§impl From<CreateRole> for Statement
impl From<CreateRole> for Statement
Source§fn from(cr: CreateRole) -> Statement
fn from(cr: CreateRole) -> Statement
Source§impl From<CreateServerStatement> for Statement
impl From<CreateServerStatement> for Statement
Source§fn from(c: CreateServerStatement) -> Statement
fn from(c: CreateServerStatement) -> Statement
Source§impl From<CreateTable> for Statement
impl From<CreateTable> for Statement
Source§fn from(c: CreateTable) -> Statement
fn from(c: CreateTable) -> Statement
Source§impl From<CreateTrigger> for Statement
impl From<CreateTrigger> for Statement
Source§fn from(c: CreateTrigger) -> Statement
fn from(c: CreateTrigger) -> Statement
Source§impl From<CreateUser> for Statement
impl From<CreateUser> for Statement
Source§fn from(c: CreateUser) -> Statement
fn from(c: CreateUser) -> Statement
Source§impl From<CreateView> for Statement
impl From<CreateView> for Statement
Source§fn from(cv: CreateView) -> Statement
fn from(cv: CreateView) -> Statement
Source§impl From<DenyStatement> for Statement
impl From<DenyStatement> for Statement
Source§fn from(d: DenyStatement) -> Statement
fn from(d: DenyStatement) -> Statement
Source§impl From<DropDomain> for Statement
impl From<DropDomain> for Statement
Source§fn from(d: DropDomain) -> Statement
fn from(d: DropDomain) -> Statement
Source§impl From<DropExtension> for Statement
impl From<DropExtension> for Statement
Source§fn from(de: DropExtension) -> Statement
fn from(de: DropExtension) -> Statement
Source§impl From<DropFunction> for Statement
impl From<DropFunction> for Statement
Source§fn from(df: DropFunction) -> Statement
fn from(df: DropFunction) -> Statement
Source§impl From<DropOperator> for Statement
impl From<DropOperator> for Statement
Source§fn from(d: DropOperator) -> Statement
fn from(d: DropOperator) -> Statement
Source§impl From<DropOperatorClass> for Statement
impl From<DropOperatorClass> for Statement
Source§fn from(d: DropOperatorClass) -> Statement
fn from(d: DropOperatorClass) -> Statement
Source§impl From<DropOperatorFamily> for Statement
impl From<DropOperatorFamily> for Statement
Source§fn from(d: DropOperatorFamily) -> Statement
fn from(d: DropOperatorFamily) -> Statement
Source§impl From<DropPolicy> for Statement
impl From<DropPolicy> for Statement
Source§fn from(v: DropPolicy) -> Statement
fn from(v: DropPolicy) -> Statement
Source§impl From<DropTrigger> for Statement
impl From<DropTrigger> for Statement
Source§fn from(d: DropTrigger) -> Statement
fn from(d: DropTrigger) -> Statement
Source§impl From<ExportData> for Statement
impl From<ExportData> for Statement
Source§fn from(e: ExportData) -> Statement
fn from(e: ExportData) -> Statement
Source§impl From<IfStatement> for Statement
impl From<IfStatement> for Statement
Source§fn from(i: IfStatement) -> Statement
fn from(i: IfStatement) -> Statement
Source§impl From<OpenStatement> for Statement
impl From<OpenStatement> for Statement
Source§fn from(o: OpenStatement) -> Statement
fn from(o: OpenStatement) -> Statement
Source§impl From<PrintStatement> for Statement
impl From<PrintStatement> for Statement
Source§fn from(p: PrintStatement) -> Statement
fn from(p: PrintStatement) -> Statement
Source§impl From<RaiseStatement> for Statement
impl From<RaiseStatement> for Statement
Source§fn from(r: RaiseStatement) -> Statement
fn from(r: RaiseStatement) -> Statement
Source§impl From<RenameTable> for Statement
impl From<RenameTable> for Statement
Source§fn from(r: RenameTable) -> Statement
fn from(r: RenameTable) -> Statement
Source§impl From<ResetStatement> for Statement
impl From<ResetStatement> for Statement
Source§fn from(r: ResetStatement) -> Statement
fn from(r: ResetStatement) -> Statement
Source§impl From<ReturnStatement> for Statement
impl From<ReturnStatement> for Statement
Source§fn from(r: ReturnStatement) -> Statement
fn from(r: ReturnStatement) -> Statement
Source§impl From<ShowCharset> for Statement
impl From<ShowCharset> for Statement
Source§fn from(s: ShowCharset) -> Statement
fn from(s: ShowCharset) -> Statement
Source§impl From<ShowObjects> for Statement
impl From<ShowObjects> for Statement
Source§fn from(s: ShowObjects) -> Statement
fn from(s: ShowObjects) -> Statement
Source§impl From<VacuumStatement> for Statement
impl From<VacuumStatement> for Statement
Source§fn from(v: VacuumStatement) -> Statement
fn from(v: VacuumStatement) -> Statement
Source§impl From<WhileStatement> for Statement
impl From<WhileStatement> for Statement
Source§fn from(w: WhileStatement) -> Statement
fn from(w: WhileStatement) -> Statement
Source§impl Ord for Statement
impl Ord for Statement
Source§impl PartialOrd for Statement
impl PartialOrd for Statement
Source§impl Spanned for Statement
§partial span
Missing spans:
impl Spanned for Statement
§partial span
Missing spans:
- Statement::CopyIntoSnowflake
- Statement::CreateSecret
- Statement::CreateRole
- Statement::AlterType
- Statement::AlterOperator
- Statement::AlterRole
- Statement::AttachDatabase
- Statement::AttachDuckDBDatabase
- Statement::DetachDuckDBDatabase
- Statement::Drop
- Statement::DropFunction
- Statement::DropProcedure
- Statement::DropSecret
- Statement::Declare
- Statement::CreateExtension
- Statement::Fetch
- Statement::Flush
- Statement::Discard
- Statement::Set
- Statement::ShowFunctions
- Statement::ShowVariable
- Statement::ShowStatus
- Statement::ShowVariables
- Statement::ShowCreate
- Statement::ShowColumns
- Statement::ShowTables
- Statement::ShowCollation
- Statement::StartTransaction
- Statement::Comment
- Statement::Commit
- Statement::Rollback
- Statement::CreateSchema
- Statement::CreateDatabase
- Statement::CreateFunction
- Statement::CreateTrigger
- Statement::DropTrigger
- Statement::CreateProcedure
- Statement::CreateMacro
- Statement::CreateStage
- Statement::Assert
- Statement::Grant
- Statement::Revoke
- Statement::Deallocate
- Statement::Execute
- Statement::Prepare
- Statement::Kill
- Statement::ExplainTable
- Statement::Explain
- Statement::Savepoint
- Statement::ReleaseSavepoint
- Statement::Cache
- Statement::UNCache
- Statement::CreateSequence
- Statement::CreateType
- Statement::Pragma
- Statement::LockTables
- Statement::UnlockTables
- Statement::Unload
- Statement::OptimizeTable
impl Eq for Statement
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnsafeUnpin for Statement
impl UnwindSafe for Statement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Key for Twhere
T: Clone,
impl<T> Key for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.