@@ -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 ,
@@ -4500,6 +4500,28 @@ pub enum Statement {
45004500 comment : Option < String > ,
45014501 } ,
45024502 /// ```sql
4503+ /// CREATE [ OR REPLACE ] [ { TEMP | TEMPORARY | VOLATILE } ] FILE FORMAT [ IF NOT EXISTS ] <name>
4504+ /// [ TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] ]
4505+ /// [ COMMENT = '<string_literal>' ]
4506+ /// ```
4507+ /// See <https://docs.snowflake.com/en/sql-reference/sql/create-file-format>
4508+ CreateFileFormat {
4509+ /// `OR REPLACE` flag.
4510+ or_replace : bool ,
4511+ /// Whether file format is temporary.
4512+ temporary : bool ,
4513+ /// Whether file format is volatile.
4514+ volatile : bool ,
4515+ /// `IF NOT EXISTS` flag.
4516+ if_not_exists : bool ,
4517+ /// File format name.
4518+ name : ObjectName ,
4519+ /// Format type options (e.g. `TYPE`, `FIELD_DELIMITER`, `COMPRESSION`, ...).
4520+ options : KeyValueOptions ,
4521+ /// Optional comment.
4522+ comment : Option < String > ,
4523+ } ,
4524+ /// ```sql
45034525 /// ASSERT <condition> [AS <message>]
45044526 /// ```
45054527 Assert {
@@ -4865,6 +4887,20 @@ pub enum Statement {
48654887 /// Snowflake `LIST`
48664888 /// See: <https://docs.snowflake.com/en/sql-reference/sql/list>
48674889 List ( FileStagingCommand ) ,
4890+ /// Snowflake `PUT`
4891+ /// ```sql
4892+ /// PUT 'file://<path>' <internalStage> [ <option> = <value> ... ]
4893+ /// ```
4894+ /// Options include `PARALLEL`, `AUTO_COMPRESS`, `SOURCE_COMPRESSION`, `OVERWRITE`.
4895+ /// See: <https://docs.snowflake.com/en/sql-reference/sql/put>
4896+ Put {
4897+ /// Local source URI as written in the statement, e.g. `file:///tmp/data.csv`.
4898+ source : String ,
4899+ /// Target internal stage (e.g. `@mystage`, `@~`, `@%table`).
4900+ stage : ObjectName ,
4901+ /// Trailing options (`PARALLEL=4`, `AUTO_COMPRESS=TRUE`, ...).
4902+ options : KeyValueOptions ,
4903+ } ,
48684904 /// Snowflake `REMOVE`
48694905 /// See: <https://docs.snowflake.com/en/sql-reference/sql/remove>
48704906 Remove ( FileStagingCommand ) ,
@@ -6186,6 +6222,31 @@ impl fmt::Display for Statement {
61866222 }
61876223 Ok ( ( ) )
61886224 }
6225+ Statement :: CreateFileFormat {
6226+ or_replace,
6227+ temporary,
6228+ volatile,
6229+ if_not_exists,
6230+ name,
6231+ options,
6232+ comment,
6233+ } => {
6234+ write ! (
6235+ f,
6236+ "CREATE {or_replace}{temp}{volatile}FILE FORMAT {if_not_exists}{name}" ,
6237+ or_replace = if * or_replace { "OR REPLACE " } else { "" } ,
6238+ temp = if * temporary { "TEMPORARY " } else { "" } ,
6239+ volatile = if * volatile { "VOLATILE " } else { "" } ,
6240+ if_not_exists = if * if_not_exists { "IF NOT EXISTS " } else { "" } ,
6241+ ) ?;
6242+ if !options. options . is_empty ( ) {
6243+ write ! ( f, " {options}" ) ?;
6244+ }
6245+ if let Some ( comment) = comment {
6246+ write ! ( f, " COMMENT='{}'" , comment) ?;
6247+ }
6248+ Ok ( ( ) )
6249+ }
61896250 Statement :: CopyIntoSnowflake {
61906251 kind,
61916252 into,
@@ -6387,6 +6448,17 @@ impl fmt::Display for Statement {
63876448 Statement :: WaitFor ( s) => write ! ( f, "{s}" ) ,
63886449 Statement :: Return ( r) => write ! ( f, "{r}" ) ,
63896450 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
6451+ Statement :: Put {
6452+ source,
6453+ stage,
6454+ options,
6455+ } => {
6456+ write ! ( f, "PUT '{source}' {stage}" ) ?;
6457+ if !options. options . is_empty ( ) {
6458+ write ! ( f, " {options}" ) ?;
6459+ }
6460+ Ok ( ( ) )
6461+ }
63906462 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
63916463 Statement :: ExportData ( e) => write ! ( f, "{e}" ) ,
63926464 Statement :: CreateUser ( s) => write ! ( f, "{s}" ) ,
@@ -12183,7 +12255,8 @@ impl fmt::Display for OptimizerHint {
1218312255 f. write_str ( prefix) ?;
1218412256 f. write_str ( & self . prefix ) ?;
1218512257 f. write_str ( "+" ) ?;
12186- f. write_str ( & self . text )
12258+ f. write_str ( & self . text ) ?;
12259+ f. write_str ( "\n " )
1218712260 }
1218812261 OptimizerHintStyle :: MultiLine => {
1218912262 f. write_str ( "/*" ) ?;
0 commit comments