@@ -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 ,
@@ -4502,6 +4502,28 @@ pub enum Statement {
45024502 comment : Option < String > ,
45034503 } ,
45044504 /// ```sql
4505+ /// CREATE [ OR REPLACE ] [ { TEMP | TEMPORARY | VOLATILE } ] FILE FORMAT [ IF NOT EXISTS ] <name>
4506+ /// [ TYPE = { CSV | JSON | AVRO | ORC | PARQUET | XML } [ formatTypeOptions ] ]
4507+ /// [ COMMENT = '<string_literal>' ]
4508+ /// ```
4509+ /// See <https://docs.snowflake.com/en/sql-reference/sql/create-file-format>
4510+ CreateFileFormat {
4511+ /// `OR REPLACE` flag.
4512+ or_replace : bool ,
4513+ /// Whether file format is temporary.
4514+ temporary : bool ,
4515+ /// Whether file format is volatile.
4516+ volatile : bool ,
4517+ /// `IF NOT EXISTS` flag.
4518+ if_not_exists : bool ,
4519+ /// File format name.
4520+ name : ObjectName ,
4521+ /// Format type options (e.g. `TYPE`, `FIELD_DELIMITER`, `COMPRESSION`, ...).
4522+ options : KeyValueOptions ,
4523+ /// Optional comment.
4524+ comment : Option < String > ,
4525+ } ,
4526+ /// ```sql
45054527 /// ASSERT <condition> [AS <message>]
45064528 /// ```
45074529 Assert {
@@ -4867,6 +4889,20 @@ pub enum Statement {
48674889 /// Snowflake `LIST`
48684890 /// See: <https://docs.snowflake.com/en/sql-reference/sql/list>
48694891 List ( FileStagingCommand ) ,
4892+ /// Snowflake `PUT`
4893+ /// ```sql
4894+ /// PUT 'file://<path>' <internalStage> [ <option> = <value> ... ]
4895+ /// ```
4896+ /// Options include `PARALLEL`, `AUTO_COMPRESS`, `SOURCE_COMPRESSION`, `OVERWRITE`.
4897+ /// See: <https://docs.snowflake.com/en/sql-reference/sql/put>
4898+ Put {
4899+ /// Local source URI as written in the statement, e.g. `file:///tmp/data.csv`.
4900+ source : String ,
4901+ /// Target internal stage (e.g. `@mystage`, `@~`, `@%table`).
4902+ stage : ObjectName ,
4903+ /// Trailing options (`PARALLEL=4`, `AUTO_COMPRESS=TRUE`, ...).
4904+ options : KeyValueOptions ,
4905+ } ,
48704906 /// Snowflake `REMOVE`
48714907 /// See: <https://docs.snowflake.com/en/sql-reference/sql/remove>
48724908 Remove ( FileStagingCommand ) ,
@@ -6192,6 +6228,31 @@ impl fmt::Display for Statement {
61926228 }
61936229 Ok ( ( ) )
61946230 }
6231+ Statement :: CreateFileFormat {
6232+ or_replace,
6233+ temporary,
6234+ volatile,
6235+ if_not_exists,
6236+ name,
6237+ options,
6238+ comment,
6239+ } => {
6240+ write ! (
6241+ f,
6242+ "CREATE {or_replace}{temp}{volatile}FILE FORMAT {if_not_exists}{name}" ,
6243+ or_replace = if * or_replace { "OR REPLACE " } else { "" } ,
6244+ temp = if * temporary { "TEMPORARY " } else { "" } ,
6245+ volatile = if * volatile { "VOLATILE " } else { "" } ,
6246+ if_not_exists = if * if_not_exists { "IF NOT EXISTS " } else { "" } ,
6247+ ) ?;
6248+ if !options. options . is_empty ( ) {
6249+ write ! ( f, " {options}" ) ?;
6250+ }
6251+ if let Some ( comment) = comment {
6252+ write ! ( f, " COMMENT='{}'" , comment) ?;
6253+ }
6254+ Ok ( ( ) )
6255+ }
61956256 Statement :: CopyIntoSnowflake {
61966257 kind,
61976258 into,
@@ -6393,6 +6454,17 @@ impl fmt::Display for Statement {
63936454 Statement :: WaitFor ( s) => write ! ( f, "{s}" ) ,
63946455 Statement :: Return ( r) => write ! ( f, "{r}" ) ,
63956456 Statement :: List ( command) => write ! ( f, "LIST {command}" ) ,
6457+ Statement :: Put {
6458+ source,
6459+ stage,
6460+ options,
6461+ } => {
6462+ write ! ( f, "PUT '{source}' {stage}" ) ?;
6463+ if !options. options . is_empty ( ) {
6464+ write ! ( f, " {options}" ) ?;
6465+ }
6466+ Ok ( ( ) )
6467+ }
63966468 Statement :: Remove ( command) => write ! ( f, "REMOVE {command}" ) ,
63976469 Statement :: ExportData ( e) => write ! ( f, "{e}" ) ,
63986470 Statement :: CreateUser ( s) => write ! ( f, "{s}" ) ,
@@ -12245,7 +12317,8 @@ impl fmt::Display for OptimizerHint {
1224512317 f. write_str ( prefix) ?;
1224612318 f. write_str ( & self . prefix ) ?;
1224712319 f. write_str ( "+" ) ?;
12248- f. write_str ( & self . text )
12320+ f. write_str ( & self . text ) ?;
12321+ f. write_str ( "\n " )
1224912322 }
1225012323 OptimizerHintStyle :: MultiLine => {
1225112324 f. write_str ( "/*" ) ?;
0 commit comments