@@ -26,7 +26,7 @@ use crate::ast::helpers::stmt_data_loading::{
2626 FileStagingCommand , StageLoadSelectItem , StageLoadSelectItemKind , StageParamsObject ,
2727} ;
2828use crate :: ast:: {
29- CatalogSyncNamespaceMode , ColumnOption , ColumnPolicy , ColumnPolicyProperty , ContactEntry ,
29+ AlterTableOperation , CatalogSyncNamespaceMode , ColumnOption , ColumnPolicy , ColumnPolicyProperty , ContactEntry ,
3030 CopyIntoSnowflakeKind , CreateTableLikeKind , DollarQuotedString , Ident , IdentityParameters ,
3131 IdentityProperty , IdentityPropertyFormatKind , IdentityPropertyKind , IdentityPropertyOrder ,
3232 InitializeKind , ObjectName , ObjectNamePart , RefreshModeKind , RowAccessPolicy , ShowObjects ,
@@ -214,6 +214,11 @@ impl Dialect for SnowflakeDialect {
214214 return Some ( parser. parse_begin_exception_end ( ) ) ;
215215 }
216216
217+ if parser. parse_keywords ( & [ Keyword :: ALTER , Keyword :: DYNAMIC , Keyword :: TABLE ] ) {
218+ // ALTER DYNAMIC TABLE
219+ return Some ( parse_alter_dynamic_table ( parser) ) ;
220+ }
221+
217222 if parser. parse_keywords ( & [ Keyword :: ALTER , Keyword :: SESSION ] ) {
218223 // ALTER SESSION
219224 let set = match parser. parse_one_of_keywords ( & [ Keyword :: SET , Keyword :: UNSET ] ) {
@@ -604,6 +609,27 @@ fn parse_file_staging_command(kw: Keyword, parser: &mut Parser) -> Result<Statem
604609 }
605610}
606611
612+ /// Parse snowflake alter dynamic table.
613+ /// <https://docs.snowflake.com/en/sql-reference/sql/alter-table>
614+ fn parse_alter_dynamic_table ( parser : & mut Parser ) -> Result < Statement , ParserError > {
615+ let table_name = parser. parse_object_name ( false ) ?;
616+
617+ // Parse the operation (currently only REFRESH is supported)
618+ if parser. parse_keyword ( Keyword :: REFRESH ) {
619+ Ok ( Statement :: AlterTable {
620+ name : table_name,
621+ if_exists : false ,
622+ only : false ,
623+ operations : vec ! [ AlterTableOperation :: Refresh ] ,
624+ location : None ,
625+ on_cluster : None ,
626+ iceberg : false ,
627+ } )
628+ } else {
629+ parser. expected ( "REFRESH after ALTER DYNAMIC TABLE" , parser. peek_token ( ) )
630+ }
631+ }
632+
607633/// Parse snowflake alter session.
608634/// <https://docs.snowflake.com/en/sql-reference/sql/alter-session>
609635fn parse_alter_session ( parser : & mut Parser , set : bool ) -> Result < Statement , ParserError > {
0 commit comments