Fix/snowflake iceberg clone dialect error by sineline · Pull Request #5722 · SQLMesh/sqlmesh
This pull request introduces enhancements to support Iceberg table operations in Snowflake, ensuring correct DDL syntax and behavior for table creation, cloning, and schema alterations. The changes primarily address the unique requirements of Iceberg tables, such as proper handling of PARTITION BY clauses and the use of ICEBERG TABLE syntax in relevant commands. Additionally, the pull request propagates table format information throughout the snapshot evaluation and migration processes.
Snowflake Iceberg Table Support:
- Added custom DDL logic in
_create_tableto correctly injectPARTITION BYclauses for Iceberg tables, ensuring compliance with Snowflake's ordering requirements and handling CTAS limitations. - Updated
clone_tableto useCREATE ICEBERG TABLE ... CLONEsyntax when cloning Iceberg tables, by passingtable_kindbased on the table format. - Implemented a Snowflake-specific
alter_tablemethod that usesALTER ICEBERG TABLEinstead ofALTER TABLEfor schema changes on Iceberg tables.
Propagation of Table Format:
- Modified snapshot evaluator logic to pass
table_formatduring snapshot cloning and table migration, enabling downstream methods to select the correct DDL syntax. [1] [2]
Base Adapter Improvements: