@@ -26,7 +26,9 @@ use alloc::{
2626} ;
2727use helpers:: {
2828 attached_token:: AttachedToken ,
29- stmt_data_loading:: { AlterStageOperation , FileStagingCommand , StageLoadSelectItemKind } ,
29+ stmt_data_loading:: {
30+ AlterFileFormatOperation , AlterStageOperation , FileStagingCommand , StageLoadSelectItemKind ,
31+ } ,
3032} ;
3133
3234use core:: cmp:: Ordering ;
@@ -4244,6 +4246,15 @@ pub enum Statement {
42444246 show_options : ShowStatementOptions ,
42454247 } ,
42464248 /// ```sql
4249+ /// SHOW FILE FORMATS [ LIKE '<pattern>' ] [ IN { ACCOUNT | DATABASE | SCHEMA } ]
4250+ /// ```
4251+ /// Snowflake-specific statement.
4252+ /// <https://docs.snowflake.com/en/sql-reference/sql/show-file-formats>
4253+ ShowFileFormats {
4254+ /// Additional options for filtering and scoping the file format listing.
4255+ show_options : ShowStatementOptions ,
4256+ } ,
4257+ /// ```sql
42474258 /// SHOW VIEWS
42484259 /// ```
42494260 ShowViews {
@@ -4547,6 +4558,18 @@ pub enum Statement {
45474558 operation : AlterStageOperation ,
45484559 } ,
45494560 /// ```sql
4561+ /// ALTER FILE FORMAT
4562+ /// ```
4563+ /// See <https://docs.snowflake.com/en/sql-reference/sql/alter-file-format>
4564+ AlterFileFormat {
4565+ /// `IF EXISTS` flag.
4566+ if_exists : bool ,
4567+ /// File format name.
4568+ name : ObjectName ,
4569+ /// File format alteration to perform.
4570+ operation : AlterFileFormatOperation ,
4571+ } ,
4572+ /// ```sql
45504573 /// CREATE FILE FORMAT
45514574 /// ```
45524575 /// See <https://docs.snowflake.com/en/sql-reference/sql/create-file-format>
@@ -4685,6 +4708,18 @@ pub enum Statement {
46854708 stage_name : ObjectName ,
46864709 } ,
46874710 /// ```sql
4711+ /// DESC[RIBE] FILE FORMAT <name>
4712+ /// ```
4713+ /// Snowflake-specific statement.
4714+ /// <https://docs.snowflake.com/en/sql-reference/sql/desc-file-format>
4715+ DescribeFileFormat {
4716+ /// `DESC | DESCRIBE` spelling used by the input statement.
4717+ describe_alias : DescribeAlias ,
4718+ /// File format name.
4719+ #[ cfg_attr( feature = "visitor" , visit( with = "visit_relation" ) ) ]
4720+ name : ObjectName ,
4721+ } ,
4722+ /// ```sql
46884723 /// [EXPLAIN | DESC | DESCRIBE] <statement>
46894724 /// ```
46904725 Explain {
@@ -5185,6 +5220,10 @@ impl fmt::Display for Statement {
51855220 describe_alias,
51865221 stage_name,
51875222 } => write ! ( f, "{describe_alias} STAGE {stage_name}" ) ,
5223+ Statement :: DescribeFileFormat {
5224+ describe_alias,
5225+ name,
5226+ } => write ! ( f, "{describe_alias} FILE FORMAT {name}" ) ,
51885227 Statement :: Explain {
51895228 describe_alias,
51905229 verbose,
@@ -5999,6 +6038,9 @@ impl fmt::Display for Statement {
59996038 Statement :: ShowStages { show_options } => {
60006039 write ! ( f, "SHOW STAGES{show_options}" )
60016040 }
6041+ Statement :: ShowFileFormats { show_options } => {
6042+ write ! ( f, "SHOW FILE FORMATS{show_options}" )
6043+ }
60026044 Statement :: ShowViews {
60036045 terse,
60046046 materialized,
@@ -6356,6 +6398,32 @@ impl fmt::Display for Statement {
63566398 }
63576399 }
63586400 }
6401+ Statement :: AlterFileFormat {
6402+ if_exists,
6403+ name,
6404+ operation,
6405+ } => {
6406+ write ! (
6407+ f,
6408+ "ALTER FILE FORMAT {if_exists}{name}" ,
6409+ if_exists = if * if_exists { "IF EXISTS " } else { "" } ,
6410+ ) ?;
6411+ match operation {
6412+ AlterFileFormatOperation :: RenameTo { new_name } => {
6413+ write ! ( f, " RENAME TO {new_name}" )
6414+ }
6415+ AlterFileFormatOperation :: Set { options, comment } => {
6416+ write ! ( f, " SET" ) ?;
6417+ if !options. options . is_empty ( ) {
6418+ write ! ( f, " {options}" ) ?;
6419+ }
6420+ if let Some ( comment) = comment {
6421+ write ! ( f, " COMMENT='{comment}'" ) ?;
6422+ }
6423+ Ok ( ( ) )
6424+ }
6425+ }
6426+ }
63596427 Statement :: CreateFileFormat {
63606428 or_replace,
63616429 temporary,
@@ -8686,6 +8754,8 @@ pub enum ObjectType {
86868754 Sequence ,
86878755 /// A stage.
86888756 Stage ,
8757+ /// A named file format.
8758+ FileFormat ,
86898759 /// A type definition.
86908760 Type ,
86918761 /// A user.
@@ -8707,6 +8777,7 @@ impl fmt::Display for ObjectType {
87078777 ObjectType :: Role => "ROLE" ,
87088778 ObjectType :: Sequence => "SEQUENCE" ,
87098779 ObjectType :: Stage => "STAGE" ,
8780+ ObjectType :: FileFormat => "FILE FORMAT" ,
87108781 ObjectType :: Type => "TYPE" ,
87118782 ObjectType :: User => "USER" ,
87128783 ObjectType :: Stream => "STREAM" ,
0 commit comments