@@ -53,7 +53,7 @@ use crate::{
5353
5454pub use self :: data_type:: {
5555 ArrayElemTypeDef , BinaryLength , CharLengthUnits , CharacterLength , DataType , EnumMember ,
56- ExactNumberInfo , IntervalFields , StructBracketKind , TimezoneInfo ,
56+ ExactNumberInfo , IntervalFields , MapBracketKind , StructBracketKind , TimezoneInfo ,
5757} ;
5858pub use self :: dcl:: {
5959 AlterRoleOperation , CreateRole , Grant , ResetConfig , Revoke , RoleOption , SecondaryRoles ,
@@ -4497,6 +4497,28 @@ pub enum Statement {
44974497 comment : Option < String > ,
44984498 } ,
44994499 /// ```sql
4500+ /// CREATE [ OR REPLACE ] [ { TEMP | TEMPORARY | VOLATILE } ] FILE FORMAT [ IF NOT EXISTS ] <name>
4501+ /// [ TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] ]
4502+ /// [ COMMENT = '<string_literal>' ]
4503+ /// ```
4504+ /// See <https://docs.snowflake.com/en/sql-reference/sql/create-file-format>
4505+ CreateFileFormat {
4506+ /// `OR REPLACE` flag.
4507+ or_replace : bool ,
4508+ /// Whether file format is temporary.
4509+ temporary : bool ,
4510+ /// Whether file format is volatile.
4511+ volatile : bool ,
4512+ /// `IF NOT EXISTS` flag.
4513+ if_not_exists : bool ,
4514+ /// File format name.
4515+ name : ObjectName ,
4516+ /// Format type options (e.g. `TYPE`, `FIELD_DELIMITER`, `COMPRESSION`, ...).
4517+ options : KeyValueOptions ,
4518+ /// Optional comment.
4519+ comment : Option < String > ,
4520+ } ,
4521+ /// ```sql
45004522 /// ASSERT <condition> [AS <message>]
45014523 /// ```
45024524 Assert {
@@ -4862,6 +4884,20 @@ pub enum Statement {
48624884 /// Snowflake `LIST`
48634885 /// See: <https://docs.snowflake.com/en/sql-reference/sql/list>
48644886 List ( FileStagingCommand ) ,
4887+ /// Snowflake `PUT`
4888+ /// ```sql
4889+ /// PUT 'file://<path>' <internalStage> [ <option> = <value> ... ]
4890+ /// ```
4891+ /// Options include `PARALLEL`, `AUTO_COMPRESS`, `SOURCE_COMPRESSION`, `OVERWRITE`.
4892+ /// See: <https://docs.snowflake.com/en/sql-reference/sql/put>
4893+ Put {
4894+ /// Local source URI as written in the statement, e.g. `file:///tmp/data.csv`.
4895+ source : String ,
4896+ /// Target internal stage (e.g. `@mystage`, `@~`, `@%table`).
4897+ stage : ObjectName ,
4898+ /// Trailing options (`PARALLEL=4`, `AUTO_COMPRESS=TRUE`, ...).
4899+ options : KeyValueOptions ,
4900+ } ,
48654901 /// Snowflake `REMOVE`
48664902 /// See: <https://docs.snowflake.com/en/sql-reference/sql/remove>
48674903 Remove ( FileStagingCommand ) ,
@@ -6183,6 +6219,31 @@ impl fmt::Display for Statement {
61836219 }
61846220 Ok ( ( ) )
61856221 }
6222+ Statement :: CreateFileFormat {
6223+ or_replace,
6224+ temporary,
6225+ volatile,
6226+ if_not_exists,
6227+ name,
6228+ options,
6229+ comment,
6230+ } => {
6231+ write ! (
6232+ f,
6233+ "CREATE {or_replace}{temp}{volatile}FILE FORMAT {if_not_exists}{name}" ,
6234+ or_replace = if * or_replace { "OR REPLACE " } else { "" } ,
6235+ temp = if * temporary { "TEMPORARY " } else { "" } ,
6236+ volatile = if * volatile { "VOLATILE " } else { "" } ,
6237+ if_not_exists = if * if_not_exists { "IF NOT EXISTS " } else { "" } ,
6238+ ) ?;
6239+ if !options. options . is_empty ( ) {
6240+ write ! ( f, " {options}" ) ?;
6241+ }
6242+ if let Some ( comment) = comment {
6243+ write ! ( f, " COMMENT='{}'" , comment) ?;
6244+ }
6245+ Ok ( ( ) )
6246+ }
61866247 Statement :: CopyIntoSnowflake {
61876248 kind,
61886249 into,
@@ -6384,6 +6445,17 @@ impl fmt::Display for Statement {
63846445 Statement :: WaitFor ( s) => write ! ( f, "{s}" ) ,
63856446 Statement :: Return ( r) => write ! ( f, "{r}" ) ,
63866447 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
6448+ Statement :: Put {
6449+ source,
6450+ stage,
6451+ options,
6452+ } => {
6453+ write ! ( f, "PUT '{source}' {stage}" ) ?;
6454+ if !options. options . is_empty ( ) {
6455+ write ! ( f, " {options}" ) ?;
6456+ }
6457+ Ok ( ( ) )
6458+ }
63876459 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
63886460 Statement :: ExportData ( e) => write ! ( f, "{e}" ) ,
63896461 Statement :: CreateUser ( s) => write ! ( f, "{s}" ) ,
@@ -12025,7 +12097,8 @@ impl fmt::Display for OptimizerHint {
1202512097 f. write_str ( prefix) ?;
1202612098 f. write_str ( & self . prefix ) ?;
1202712099 f. write_str ( "+" ) ?;
12028- f. write_str ( & self . text )
12100+ f. write_str ( & self . text ) ?;
12101+ f. write_str ( "\n " )
1202912102 }
1203012103 OptimizerHintStyle :: MultiLine => {
1203112104 f. write_str ( "/*" ) ?;
0 commit comments