@@ -23,9 +23,10 @@ use crate::ast::helpers::stmt_data_loading::{
23
23
StageLoadSelectItem , StageParamsObject ,
24
24
} ;
25
25
use crate :: ast:: {
26
- ColumnOption , ColumnPolicy , ColumnPolicyProperty , Ident , IdentityParameters , IdentityProperty ,
27
- IdentityPropertyFormatKind , IdentityPropertyKind , IdentityPropertyOrder , ObjectName ,
28
- RowAccessPolicy , Statement , TagsColumnOption , WrappedCollection ,
26
+ ColumnOption , ColumnPolicy , ColumnPolicyProperty , Ident ,
27
+ IdentityParameters , IdentityProperty , IdentityPropertyFormatKind , IdentityPropertyKind ,
28
+ IdentityPropertyOrder , ObjectName , RowAccessPolicy , Statement , TagsColumnOption ,
29
+ WrappedCollection ,
29
30
} ;
30
31
use crate :: dialect:: { Dialect , Precedence } ;
31
32
use crate :: keywords:: Keyword ;
@@ -187,6 +188,17 @@ impl Dialect for SnowflakeDialect {
187
188
return Some ( parse_file_staging_command ( kw, parser) ) ;
188
189
}
189
190
191
+ if parser. parse_keyword ( Keyword :: SHOW ) {
192
+ let terse = parser. parse_keyword ( Keyword :: TERSE ) ;
193
+ if parser. parse_keyword ( Keyword :: OBJECTS ) {
194
+ return Some ( parse_show_objects ( terse, parser) ) ;
195
+ } else {
196
+ return Some ( parser. parse_show ( ) ) ;
197
+ }
198
+ }
199
+
200
+
201
+
190
202
None
191
203
}
192
204
@@ -264,7 +276,7 @@ impl Dialect for SnowflakeDialect {
264
276
fn is_select_item_alias ( & self , explicit : bool , kw : & Keyword , parser : & mut Parser ) -> bool {
265
277
explicit
266
278
|| match kw {
267
- // The following keywords can be considered an alias as long as
279
+ // The following keywords can be considered an alias as long as
268
280
// they are not followed by other tokens that may change their meaning
269
281
// e.g. `SELECT * EXCEPT (col1) FROM tbl`
270
282
Keyword :: EXCEPT
@@ -286,8 +298,8 @@ impl Dialect for SnowflakeDialect {
286
298
false
287
299
}
288
300
289
- // Reserved keywords by the Snowflake dialect, which seem to be less strictive
290
- // than what is listed in `keywords::RESERVED_FOR_COLUMN_ALIAS`. The following
301
+ // Reserved keywords by the Snowflake dialect, which seem to be less strictive
302
+ // than what is listed in `keywords::RESERVED_FOR_COLUMN_ALIAS`. The following
291
303
// keywords were tested with the this statement: `SELECT 1 <KW>`.
292
304
Keyword :: FROM
293
305
| Keyword :: GROUP
@@ -966,7 +978,7 @@ fn parse_session_options(parser: &mut Parser, set: bool) -> Result<Vec<DataLoadi
966
978
} ) ;
967
979
Ok ( ( ) )
968
980
}
969
-
981
+
970
982
} ,
971
983
_ => parser. expected ( "another option" , parser. peek_token ( ) ) ,
972
984
} ?;
@@ -1115,3 +1127,13 @@ fn parse_column_tags(parser: &mut Parser, with: bool) -> Result<TagsColumnOption
1115
1127
1116
1128
Ok ( TagsColumnOption { with, tags } )
1117
1129
}
1130
+
1131
+ /// Parse snowflake show objects.
1132
+ /// <https://docs.snowflake.com/en/sql-reference/sql/show-objects>
1133
+ fn parse_show_objects ( terse : bool , parser : & mut Parser ) -> Result < Statement , ParserError > {
1134
+ let show_options = parser. parse_show_stmt_options ( ) ?;
1135
+ Ok ( Statement :: ShowObjects {
1136
+ terse,
1137
+ show_options,
1138
+ } )
1139
+ }
0 commit comments