pub enum Statement {
Show 94 variants
Analyze {
table_name: ObjectName,
partitions: Option<Vec<Expr>>,
for_columns: bool,
columns: Vec<Ident>,
cache_metadata: bool,
noscan: bool,
compute_statistics: bool,
},
Truncate {
table_names: Vec<TruncateTableTarget>,
partitions: Option<Vec<Expr>>,
table: bool,
only: bool,
identity: Option<TruncateIdentityOption>,
cascade: Option<TruncateCascadeOption>,
on_cluster: Option<Ident>,
},
Msck {
table_name: ObjectName,
repair: bool,
partition_action: Option<AddDropSync>,
},
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>,
},
Call(Function),
Copy {
source: CopySource,
to: bool,
target: CopyTarget,
options: Vec<CopyOption>,
legacy_options: Vec<CopyLegacyOption>,
values: Vec<Option<String>>,
},
CopyIntoSnowflake {
into: ObjectName,
from_stage: ObjectName,
from_stage_alias: Option<Ident>,
stage_params: StageParamsObject,
from_transformations: Option<Vec<StageLoadSelectItem>>,
files: Option<Vec<String>>,
pattern: Option<String>,
file_format: DataLoadingOptions,
copy_options: DataLoadingOptions,
validation_mode: Option<String>,
},
Close {
cursor: CloseCursor,
},
Update {
table: TableWithJoins,
assignments: Vec<Assignment>,
from: Option<TableWithJoins>,
selection: Option<Expr>,
returning: Option<Vec<SelectItem>>,
or: Option<SqliteOnConflict>,
},
Delete(Delete),
CreateView {
or_replace: bool,
materialized: bool,
name: ObjectName,
columns: Vec<ViewColumnDef>,
query: Box<Query>,
options: CreateTableOptions,
cluster_by: Vec<Ident>,
comment: Option<String>,
with_no_schema_binding: bool,
if_not_exists: bool,
temporary: bool,
to: Option<ObjectName>,
},
CreateTable(CreateTable),
CreateVirtualTable {
name: ObjectName,
if_not_exists: bool,
module_name: Ident,
module_args: Vec<Ident>,
},
CreateIndex(CreateIndex),
CreateRole {Show 18 fields
names: Vec<ObjectName>,
if_not_exists: bool,
login: Option<bool>,
inherit: Option<bool>,
bypassrls: Option<bool>,
password: Option<Password>,
superuser: Option<bool>,
create_db: Option<bool>,
create_role: Option<bool>,
replication: Option<bool>,
connection_limit: Option<Expr>,
valid_until: Option<Expr>,
in_role: Vec<Ident>,
in_group: Vec<Ident>,
role: Vec<Ident>,
user: Vec<Ident>,
admin: Vec<Ident>,
authorization_owner: Option<ObjectName>,
},
CreateSecret {
or_replace: bool,
temporary: Option<bool>,
if_not_exists: bool,
name: Option<Ident>,
storage_specifier: Option<Ident>,
secret_type: Ident,
options: Vec<SecretOption>,
},
CreatePolicy {
name: Ident,
table_name: ObjectName,
policy_type: Option<CreatePolicyType>,
command: Option<CreatePolicyCommand>,
to: Option<Vec<Owner>>,
using: Option<Expr>,
with_check: Option<Expr>,
},
AlterTable {
name: ObjectName,
if_exists: bool,
only: bool,
operations: Vec<AlterTableOperation>,
location: Option<HiveSetLocation>,
on_cluster: Option<Ident>,
},
AlterIndex {
name: ObjectName,
operation: AlterIndexOperation,
},
AlterView {
name: ObjectName,
columns: Vec<Ident>,
query: Box<Query>,
with_options: Vec<SqlOption>,
},
AlterRole {
name: Ident,
operation: AlterRoleOperation,
},
AlterPolicy {
name: Ident,
table_name: ObjectName,
operation: AlterPolicyOperation,
},
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,
},
DropFunction {
if_exists: bool,
func_desc: Vec<FunctionDesc>,
option: Option<ReferentialAction>,
},
DropProcedure {
if_exists: bool,
proc_desc: Vec<FunctionDesc>,
option: Option<ReferentialAction>,
},
DropSecret {
if_exists: bool,
temporary: Option<bool>,
name: Ident,
storage_specifier: Option<Ident>,
},
DropPolicy {
if_exists: bool,
name: Ident,
table_name: ObjectName,
option: Option<ReferentialAction>,
},
Declare {
stmts: Vec<Declare>,
},
CreateExtension {
name: Ident,
if_not_exists: bool,
cascade: bool,
schema: Option<Ident>,
version: Option<Ident>,
},
Fetch {
name: Ident,
direction: FetchDirection,
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,
},
SetRole {
context_modifier: ContextModifier,
role_name: Option<Ident>,
},
SetVariable {
local: bool,
hivevar: bool,
variables: OneOrManyWithParens<ObjectName>,
value: Vec<Expr>,
},
SetTimeZone {
local: bool,
value: Expr,
},
SetNames {
charset_name: String,
collation_name: Option<String>,
},
SetNamesDefault {},
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,
},
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>,
},
SetTransaction {
modes: Vec<TransactionMode>,
snapshot: Option<Value>,
session: bool,
},
Comment {
object_type: CommentObject,
object_name: ObjectName,
comment: Option<String>,
if_exists: bool,
},
Commit {
chain: bool,
},
Rollback {
chain: bool,
savepoint: Option<Ident>,
},
CreateSchema {
schema_name: SchemaName,
if_not_exists: bool,
},
CreateDatabase {
db_name: ObjectName,
if_not_exists: bool,
location: Option<String>,
managed_location: Option<String>,
},
CreateFunction(CreateFunction),
CreateTrigger {Show 13 fields
or_replace: bool,
is_constraint: bool,
name: ObjectName,
period: TriggerPeriod,
events: Vec<TriggerEvent>,
table_name: ObjectName,
referenced_table_name: Option<ObjectName>,
referencing: Vec<TriggerReferencing>,
trigger_object: TriggerObject,
include_each: bool,
condition: Option<Expr>,
exec_body: TriggerExecBody,
characteristics: Option<ConstraintCharacteristics>,
},
DropTrigger {
if_exists: bool,
trigger_name: ObjectName,
table_name: ObjectName,
option: Option<ReferentialAction>,
},
CreateProcedure {
or_alter: bool,
name: ObjectName,
params: Option<Vec<ProcedureParam>>,
body: Vec<Statement>,
},
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: DataLoadingOptions,
file_format: DataLoadingOptions,
copy_options: DataLoadingOptions,
comment: Option<String>,
},
Assert {
condition: Expr,
message: Option<Expr>,
},
Grant {
privileges: Privileges,
objects: GrantObjects,
grantees: Vec<Ident>,
with_grant_option: bool,
granted_by: Option<Ident>,
},
Revoke {
privileges: Privileges,
objects: GrantObjects,
grantees: Vec<Ident>,
granted_by: Option<Ident>,
cascade: bool,
},
Deallocate {
name: Ident,
prepare: bool,
},
Execute {
name: ObjectName,
parameters: Vec<Expr>,
has_parentheses: bool,
using: Vec<Expr>,
},
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,
statement: Box<Statement>,
format: Option<AnalyzeFormat>,
options: Option<Vec<UtilityOption>>,
},
Savepoint {
name: Ident,
},
ReleaseSavepoint {
name: Ident,
},
Merge {
into: bool,
table: TableFactor,
source: TableFactor,
on: Box<Expr>,
clauses: Vec<MergeClause>,
},
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>,
},
CreateType {
name: ObjectName,
representation: UserDefinedTypeRepresentation,
},
Pragma {
name: ObjectName,
value: Option<Value>,
is_eq: bool,
},
LockTables {
tables: Vec<LockTable>,
},
UnlockTables,
Unload {
query: Box<Query>,
to: Ident,
with: Vec<SqlOption>,
},
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>,
},
}Expand description
A top-level statement (SELECT, INSERT, CREATE, etc.)
Variants§
Analyze
ANALYZEAnalyze (Hive)
Fields
table_name: ObjectNameTruncate
TRUNCATETruncate (Hive)
Fields
table_names: Vec<TruncateTableTarget>identity: Option<TruncateIdentityOption>Postgres-specific option [ RESTART IDENTITY | CONTINUE IDENTITY ]
cascade: Option<TruncateCascadeOption>Postgres-specific option [ CASCADE | RESTRICT ]
Msck
MSCKMsck (Hive)
Query(Box<Query>)
SELECTInsert(Insert)
INSERTInstall
INSTALLLoad
LOADDirectory
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 INTOSee https://docs.snowflake.com/en/sql-reference/sql/copy-into-table 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
into: ObjectNamefrom_stage: ObjectNamestage_params: StageParamsObjectfrom_transformations: Option<Vec<StageLoadSelectItem>>file_format: DataLoadingOptionscopy_options: DataLoadingOptionsClose
CLOSECloses the portal underlying an open cursor.
Fields
cursor: CloseCursorCursor name
Update
UPDATEFields
table: TableWithJoinsTABLE
assignments: Vec<Assignment>Column assignments
from: Option<TableWithJoins>Table which provide value to be set
returning: Option<Vec<SelectItem>>RETURNING
or: Option<SqliteOnConflict>SQLite-specific conflict resolution clause
Delete(Delete)
DELETECreateView
CREATE VIEWFields
name: ObjectNameView name
columns: Vec<ViewColumnDef>options: CreateTableOptionscomment: Option<String>Snowflake: Views can have comments in Snowflake. https://docs.snowflake.com/en/sql-reference/sql/create-view#syntax
with_no_schema_binding: boolif true, has RedShift [WITH NO SCHEMA BINDING] clause https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_VIEW.html
if_not_exists: boolif true, has SQLite IF NOT EXISTS clause https://www.sqlite.org/lang_createview.html
temporary: boolif true, has SQLite TEMP or TEMPORARY clause https://www.sqlite.org/lang_createview.html
to: Option<ObjectName>if not None, has Clickhouse TO clause, specify the table into which to insert results
https://clickhouse.com/docs/en/sql-reference/statements/create/view#materialized-view
CreateTable(CreateTable)
CREATE TABLECreateVirtualTable
CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)`Sqlite specific statement
CreateIndex(CreateIndex)
`CREATE INDEX`CreateRole
CREATE ROLESee postgres
CreateSecret
CREATE SECRETSee duckdb
Fields
options: Vec<SecretOption>CreatePolicy
CREATE POLICYSee PostgreSQL
Fields
table_name: ObjectNamepolicy_type: Option<CreatePolicyType>command: Option<CreatePolicyCommand>AlterTable
ALTER TABLEFields
name: ObjectNameTable name
operations: Vec<AlterTableOperation>location: Option<HiveSetLocation>on_cluster: Option<Ident>ClickHouse dialect supports ON CLUSTER clause for ALTER TABLE
For example: ALTER TABLE table_name ON CLUSTER cluster_name ADD COLUMN c UInt32
ClickHouse
AlterIndex
ALTER INDEXAlterView
ALTER VIEWFields
name: ObjectNameView name
AlterRole
ALTER ROLEAlterPolicy
ALTER POLICY <NAME> ON <TABLE NAME> [<OPERATION>](Postgresql-specific)
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>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.
DropFunction
DROP FUNCTIONFields
func_desc: Vec<FunctionDesc>One or more function to drop
option: Option<ReferentialAction>CASCADE or RESTRICT
DropProcedure
DROP PROCEDUREFields
proc_desc: Vec<FunctionDesc>One or more function to drop
option: Option<ReferentialAction>CASCADE or RESTRICT
DropSecret
DROP SECRETDropPolicy
DROP POLICYSee PostgreSQL
Declare
DECLAREDeclare Cursor Variables
Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
CreateExtension
CREATE EXTENSION [ IF NOT EXISTS ] extension_name
[ WITH ] [ SCHEMA schema_name ]
[ VERSION version ]
[ CASCADE ]Note: this is a PostgreSQL-specific statement,
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: FetchDirectioninto: Option<ObjectName>Optional, It’s possible to fetch rows form cursor to the table
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.
Discard
DISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ]Note: this is a PostgreSQL-specific statement, but may also compatible with other SQL.
Fields
object_type: DiscardObjectSetRole
SET [ SESSION | LOCAL ] ROLE role_nameSets session state. Examples: ANSI, Postgresql, MySQL, and Oracle
Fields
context_modifier: ContextModifierNon-ANSI optional identifier to inform if the role is defined inside the current session (SESSION) or transaction (LOCAL).
SetVariable
SET <variable> = expression;
SET (variable[, ...]) = (expression[, ...]);Note: this is not a standard SQL statement, but it is supported by at least MySQL and PostgreSQL. Not all MySQL-specific syntactic forms are supported yet.
SetTimeZone
SET TIME ZONE <value>Note: this is a PostgreSQL-specific statements
SET TIME ZONE <value> is an alias for SET timezone TO <value> in PostgreSQL
SetNames
SET NAMES 'charset_name' [COLLATE 'collation_name']Note: this is a MySQL-specific statement.
SetNamesDefault
SET NAMES DEFAULTNote: this is a MySQL-specific statement.
ShowFunctions
SHOW FUNCTIONS
Note: this is a Presto-specific statement.
Fields
filter: Option<ShowStatementFilter>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.
ShowVariables
SHOW VARIABLESNote: this is a MySQL-specific statement.
ShowCreate
SHOW CREATE TABLENote: this is a MySQL-specific statement.
ShowColumns
SHOW COLUMNSShowDatabases
SHOW DATABASESShowSchemas
SHOW SCHEMASShowTables
SHOW TABLESFields
show_options: ShowStatementOptionsShowViews
SHOW VIEWSShowCollation
SHOW COLLATIONNote: this is a MySQL-specific statement.
Fields
filter: Option<ShowStatementFilter>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: Option<BeginTransactionKind>modifier: Option<TransactionModifier>Only for SQLite
SetTransaction
SET TRANSACTION ...Comment
COMMENT ON ...Note: this is a PostgreSQL-specific statement.
Fields
object_type: CommentObjectobject_name: ObjectNameif_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 ]Rollback
ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] [ TO [ SAVEPOINT ] savepoint_name ]CreateSchema
CREATE SCHEMAFields
schema_name: SchemaName<schema name> | AUTHORIZATION <schema authorization identifier> | <schema name> AUTHORIZATION <schema authorization identifier>
CreateDatabase
CREATE DATABASEFields
db_name: ObjectNameCreateFunction(CreateFunction)
CreateTrigger
CREATE TRIGGER
Examples:
CREATE TRIGGER trigger_name
BEFORE INSERT ON table_name
FOR EACH ROW
EXECUTE FUNCTION trigger_function();Postgres: https://www.postgresql.org/docs/current/sql-createtrigger.html
Fields
or_replace: boolThe OR REPLACE clause is used to re-create the trigger if it already exists.
Example:
CREATE OR REPLACE TRIGGER trigger_name
AFTER INSERT ON table_name
FOR EACH ROW
EXECUTE FUNCTION trigger_function();name: ObjectNameThe name of the trigger to be created.
period: TriggerPeriodDetermines whether the function is called before, after, or instead of the event.
Example of BEFORE:
CREATE TRIGGER trigger_name
BEFORE INSERT ON table_name
FOR EACH ROW
EXECUTE FUNCTION trigger_function();Example of AFTER:
CREATE TRIGGER trigger_name
AFTER INSERT ON table_name
FOR EACH ROW
EXECUTE FUNCTION trigger_function();Example of INSTEAD OF:
CREATE TRIGGER trigger_name
INSTEAD OF INSERT ON table_name
FOR EACH ROW
EXECUTE FUNCTION trigger_function();events: Vec<TriggerEvent>Multiple events can be specified using OR, such as INSERT, UPDATE, DELETE, or TRUNCATE.
table_name: ObjectNameThe table on which the trigger is to be created.
referenced_table_name: Option<ObjectName>The optional referenced table name that can be referenced via
the FROM keyword.
referencing: Vec<TriggerReferencing>This keyword immediately precedes the declaration of one or two relation names that provide access to the transition relations of the triggering statement.
trigger_object: TriggerObjectThis specifies whether the trigger function should be fired once for every row affected by the trigger event, or just once per SQL statement.
exec_body: TriggerExecBodyExecute logic block
characteristics: Option<ConstraintCharacteristics>The characteristic of the trigger, which include whether the trigger is DEFERRABLE, INITIALLY DEFERRED, or INITIALLY IMMEDIATE,
DropTrigger
DROP TRIGGER
DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]Fields
trigger_name: ObjectNametable_name: ObjectNameoption: Option<ReferentialAction>CASCADE or RESTRICT
CreateProcedure
CREATE PROCEDURECreateMacro
CreateStage
CREATE STAGESee https://docs.snowflake.com/en/sql-reference/sql/create-stage
Fields
name: ObjectNamestage_params: StageParamsObjectdirectory_table_params: DataLoadingOptionsfile_format: DataLoadingOptionscopy_options: DataLoadingOptionsAssert
ASSERT <condition> [AS <message>]Grant
GRANT privileges ON objects TO granteesRevoke
REVOKE privileges ON objects FROM granteesDeallocate
DEALLOCATE [ PREPARE ] { name | ALL }Note: this is a PostgreSQL-specific statement.
Execute
EXECUTE name [ ( parameter [, ...] ) ] [USING <expr>]Note: this statement is supported by Postgres and MSSQL, with slight differences in syntax.
Postgres: 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
Prepare
PREPARE name [ ( data_type [, ...] ) ] AS statementNote: this is a PostgreSQL-specific statement.
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
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
format: Option<AnalyzeFormat>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
A MERGE statement.
MERGE INTO <target_table> USING <source> ON <join_expr> { matchedClause | notMatchedClause } [ ... ]Fields
table: TableFactorSpecifies the table to merge
source: TableFactorSpecifies the table or subquery to join with the target table
clauses: Vec<MergeClause>Specifies the actions to perform when values match or do not match.
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:
CreateType
CREATE TYPE <name>Pragma
PRAGMA <schema-name>.<pragma-name> = <pragma-value>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
UNLOAD(statement) TO <destination> [ WITH options ]See Redshift https://docs.aws.amazon.com/redshift/latest/dg/r_UNLOAD.html and
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
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
LoadData
LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename
[PARTITION (partcol1=val1, partcol2=val2 ...)]
[INPUTFORMAT 'inputformat' SERDE 'serde']Loading files into tables
Trait Implementations§
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::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::SetRole
- Statement::SetVariable
- Statement::SetTimeZone
- Statement::SetNames
- Statement::SetNamesDefault
- Statement::ShowFunctions
- Statement::ShowVariable
- Statement::ShowStatus
- Statement::ShowVariables
- Statement::ShowCreate
- Statement::ShowColumns
- Statement::ShowTables
- Statement::ShowCollation
- Statement::StartTransaction
- Statement::SetTransaction
- 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::Merge
- Statement::Cache
- Statement::UNCache
- Statement::CreateSequence
- Statement::CreateType
- Statement::Pragma
- Statement::LockTables
- Statement::UnlockTables
- Statement::Unload
- Statement::OptimizeTable
Source§impl TryFrom<Statement> for CreateTableBuilder
impl TryFrom<Statement> for CreateTableBuilder
Source§type Error = ParserError
type Error = ParserError
Source§fn try_from(
stmt: Statement,
) -> Result<CreateTableBuilder, <CreateTableBuilder as TryFrom<Statement>>::Error>
fn try_from( stmt: Statement, ) -> Result<CreateTableBuilder, <CreateTableBuilder as TryFrom<Statement>>::Error>
Source§impl VisitMut for Statement
impl VisitMut for Statement
fn visit<V>(&mut self, visitor: &mut V) -> ControlFlow<<V as VisitorMut>::Break>where
V: VisitorMut,
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 UnwindSafe for Statement
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo* type which aligns Self to ALIGNMENT.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§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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
Source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
Source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
Source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read more