@@ -29,12 +29,13 @@ use crate::ast::helpers::stmt_data_loading::{
2929use crate :: ast:: {
3030 AlterTable , AlterTableOperation , AlterTableType , CatalogSyncNamespaceMode , ColumnOption ,
3131 ColumnPolicy , ColumnPolicyProperty , ContactEntry , CopyIntoSnowflakeKind , CreateTable ,
32- CreateTableLikeKind , DollarQuotedString , Ident , IdentityParameters , IdentityProperty ,
33- IdentityPropertyFormatKind , IdentityPropertyKind , IdentityPropertyOrder , InitializeKind ,
34- Insert , MultiTableInsertIntoClause , MultiTableInsertType , MultiTableInsertValue ,
35- MultiTableInsertValues , MultiTableInsertWhenClause , ObjectName , ObjectNamePart ,
36- RefreshModeKind , RowAccessPolicy , ShowObjects , SqlOption , Statement , StorageLifecyclePolicy ,
37- StorageSerializationPolicy , TableObject , TagsColumnOption , Value , WrappedCollection ,
32+ CreateTableLikeKind , DescribeAlias , DescribeExternalVolume , DollarQuotedString , Ident ,
33+ IdentityParameters , IdentityProperty , IdentityPropertyFormatKind , IdentityPropertyKind ,
34+ IdentityPropertyOrder , InitializeKind , Insert , MultiTableInsertIntoClause ,
35+ MultiTableInsertType , MultiTableInsertValue , MultiTableInsertValues ,
36+ MultiTableInsertWhenClause , ObjectName , ObjectNamePart , RefreshModeKind , RowAccessPolicy ,
37+ ShowObjects , SqlOption , Statement , StorageLifecyclePolicy , StorageSerializationPolicy ,
38+ TableObject , TagsColumnOption , Value , WrappedCollection ,
3839} ;
3940use crate :: dialect:: { Dialect , Precedence } ;
4041use crate :: keywords:: Keyword ;
@@ -308,6 +309,20 @@ impl Dialect for SnowflakeDialect {
308309 return Some ( parse_alter_session ( parser, set) ) ;
309310 }
310311
312+ if let Some ( kw) = parser. parse_one_of_keywords ( & [ Keyword :: DESC , Keyword :: DESCRIBE ] ) {
313+ if parser. parse_keywords ( & [ Keyword :: EXTERNAL , Keyword :: VOLUME ] ) {
314+ // DESC[RIBE] EXTERNAL VOLUME
315+ let describe_alias = if kw == Keyword :: DESC {
316+ DescribeAlias :: Desc
317+ } else {
318+ DescribeAlias :: Describe
319+ } ;
320+ return Some ( parse_describe_external_volume ( describe_alias, parser) ) ;
321+ }
322+ // not EXTERNAL VOLUME — put back DESC/DESCRIBE
323+ parser. prev_token ( ) ;
324+ }
325+
311326 if parser. parse_keyword ( Keyword :: CREATE ) {
312327 // possibly CREATE STAGE
313328 //[ OR REPLACE ]
@@ -2018,3 +2033,16 @@ fn parse_multi_table_insert_when_clauses(
20182033
20192034 Ok ( ( when_clauses, else_clause) )
20202035}
2036+
2037+ /// Parse `DESC[RIBE] EXTERNAL VOLUME <name>`
2038+ fn parse_describe_external_volume (
2039+ describe_alias : DescribeAlias ,
2040+ parser : & mut Parser ,
2041+ ) -> Result < Statement , ParserError > {
2042+ let name = parser. parse_object_name ( false ) ?;
2043+ Ok ( DescribeExternalVolume {
2044+ describe_alias,
2045+ name,
2046+ }
2047+ . into ( ) )
2048+ }
0 commit comments