Skip to content

Fix PARTITION BY placement in CREATE ICEBERG TABLE for built-in catalog#1726

Open
jecolvin wants to merge 2 commits intodbt-labs:mainfrom
jecolvin:fix/iceberg-partition-by-ordering
Open

Fix PARTITION BY placement in CREATE ICEBERG TABLE for built-in catalog#1726
jecolvin wants to merge 2 commits intodbt-labs:mainfrom
jecolvin:fix/iceberg-partition-by-ordering

Conversation

@jecolvin
Copy link

@jecolvin jecolvin commented Mar 6, 2026

Summary

  • Moves PARTITION BY clause to appear immediately after column definitions, before EXTERNAL_VOLUME/CATALOG/BASE_LOCATION, matching Snowflake's required CREATE ICEBERG TABLE syntax
  • Adds ordering assertion to the built-in catalog integration test to prevent regression

Test plan

  • Unit tests pass (174/174)
  • Integration tests (test_iceberg_partition_by.py) validated in CI (requires Snowflake Iceberg infrastructure)

Closes #1720

@jecolvin jecolvin requested a review from a team as a code owner March 6, 2026 21:37
@cla-bot cla-bot bot added the cla:yes The PR author has signed the CLA label Mar 6, 2026
Move PARTITION BY clause to appear immediately after column definitions,
before EXTERNAL_VOLUME/CATALOG/BASE_LOCATION, matching Snowflake's
required CREATE ICEBERG TABLE syntax.

Closes dbt-labs#1720
Copilot AI review requested due to automatic review settings March 17, 2026 14:13
@jecolvin jecolvin force-pushed the fix/iceberg-partition-by-ordering branch from 9f027de to df378fb Compare March 17, 2026 14:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the generated Snowflake CREATE ICEBERG TABLE DDL for built-in catalogs by placing the PARTITION BY clause in the correct location per Snowflake’s required syntax, and adds a regression assertion to ensure clause ordering stays correct.

Changes:

  • Move PARTITION BY to immediately follow column definitions in the built-in catalog Iceberg table creation macro.
  • Add an integration-test assertion verifying partition by appears before external_volume.
  • Add an unreleased “Fixes” changelog entry for the bugfix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
dbt-snowflake/src/dbt/include/snowflake/macros/relations/table/create.sql Reorders built-in Iceberg DDL to place PARTITION BY before EXTERNAL_VOLUME/CATALOG/BASE_LOCATION.
dbt-snowflake/tests/functional/iceberg/test_iceberg_partition_by.py Adds an ordering assertion to prevent regression in generated DDL.
dbt-snowflake/.changes/unreleased/Fixes-20260306-163035.yaml Records the fix in unreleased changelog metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla:yes The PR author has signed the CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PARTITION BY placed in wrong position in CREATE ICEBERG TABLE DDL for Snowflake

3 participants