Skip to content

feat(snowflake) Add COPY TAGS support mirroring COPY GRANTS behavior - #1858

Merged
colin-k-rogers merged 4 commits into
dbt-labs:mainfrom
sfc-gh-yostrinsky:feature/copy-tags
May 8, 2026
Merged

feat(snowflake) Add COPY TAGS support mirroring COPY GRANTS behavior#1858
colin-k-rogers merged 4 commits into
dbt-labs:mainfrom
sfc-gh-yostrinsky:feature/copy-tags

Conversation

@sfc-gh-yostrinsky

Copy link
Copy Markdown
Contributor

Summary

  • Adds copy_tags config option (boolean, default false) mirroring copy_grants
  • Supports Snowflake's COPY TAGS parameter (GA Apr 2, 2026) for CREATE OR REPLACE TABLE
  • Applied to: regular tables, built-in Iceberg tables, and clone operations
  • Not applied to Iceberg REST (no CREATE OR REPLACE support)

Resolves #1857

Changes

  • impl.pycopy_tags: Optional[bool] = None in SnowflakeConfig
  • table/create.sqlCOPY TAGS clause in snowflake__create_table_info_schema_sql and snowflake__create_table_built_in_sql
  • clone.sqlCOPY TAGS clause in snowflake__create_or_replace_clone
  • tests/unit/test_copy_tags.py — Unit tests for config field validation
  • tests/functional/adapter/test_copy_tags.py — Functional tests verifying DDL output

Test plan

  • Unit tests pass: pytest tests/unit/test_copy_tags.py
  • Functional tests pass: pytest tests/functional/adapter/test_copy_tags.py.
  • Existing test_extra_config tests still pass (no regressions)
  • Verify copy_tags appears in compiled SQL when enabled
  • Verify copy_tags does NOT appear when disabled (default)

Snowflake's new COPY TAGS parameter (GA as of Apr 2, 2026) retains tags
from a replaced table and its columns during CREATE OR REPLACE TABLE.
This adds identical support to COPY GRANTS across all applicable macros.
@sfc-gh-yostrinsky
sfc-gh-yostrinsky requested a review from a team as a code owner April 13, 2026 12:51
@cla-bot cla-bot Bot added the cla:yes The PR author has signed the CLA label Apr 13, 2026
@github-actions github-actions Bot added the community A PR, or an issue with a PR, from a community member label Apr 13, 2026
@sfc-gh-yostrinsky sfc-gh-yostrinsky changed the title Add COPY TAGS support mirroring COPY GRANTS behavior feat(snowflake) Add COPY TAGS support mirroring COPY GRANTS behavior Apr 23, 2026
@colin-k-rogers
colin-k-rogers requested a review from Copilot May 7, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Snowflake adapter support for Snowflake’s COPY TAGS clause, modeled after existing copy_grants behavior, and verifies behavior via unit + functional tests.

Changes:

  • Introduces copy_tags as an adapter config field (SnowflakeConfig) and wires it into DDL generation.
  • Emits copy tags in CREATE OR REPLACE TABLE (regular + built-in Iceberg) and CREATE OR REPLACE … CLONE when enabled.
  • Adds unit/functional tests plus an unreleased changelog entry for the feature.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
dbt-snowflake/src/dbt/adapters/snowflake/impl.py Adds copy_tags to SnowflakeConfig so the config is recognized/typed by the adapter.
dbt-snowflake/src/dbt/include/snowflake/macros/relations/table/create.sql Adds conditional copy tags emission for regular and built-in Iceberg create/replace table SQL.
dbt-snowflake/src/dbt/include/snowflake/macros/materializations/clone.sql Adds conditional copy tags emission for clone DDL.
dbt-snowflake/tests/unit/test_copy_tags.py Unit tests around SnowflakeConfig.copy_tags defaults and independence from copy_grants.
dbt-snowflake/tests/functional/adapter/test_copy_tags.py Functional tests asserting compiled SQL includes/excludes copy tags appropriately.
dbt-snowflake/.changes/unreleased/Features-20260413-120000.yaml Unreleased changelog entry describing the new capability.

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

Comment thread dbt-snowflake/tests/unit/test_copy_tags.py Outdated
Comment thread dbt-snowflake/.changes/unreleased/Features-20260413-120000.yaml Outdated
Small copilot comments

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@colin-k-rogers
colin-k-rogers enabled auto-merge (squash) May 7, 2026 23:32
@colin-k-rogers
colin-k-rogers merged commit 6b4f24a into dbt-labs:main May 8, 2026
24 of 26 checks passed
@ltroy-cherry

Copy link
Copy Markdown

@sfc-gh-yostrinsky Is there a reason this doesn't work for views?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:approve-public-fork-ci cla:yes The PR author has signed the CLA community A PR, or an issue with a PR, from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] dbt-snowflake add support to COPY TAGS

4 participants