Skip to content

(draft backup) Ibelianski snowflake dynamic table schedile singleton#1709

Draft
igorbelianski-cyber wants to merge 2 commits intodbt-labs:mainfrom
igorbelianski-cyber:ibelianski-snowflake-dynamic-table-schedile-singleton
Draft

(draft backup) Ibelianski snowflake dynamic table schedile singleton#1709
igorbelianski-cyber wants to merge 2 commits intodbt-labs:mainfrom
igorbelianski-cyber:ibelianski-snowflake-dynamic-table-schedile-singleton

Conversation

@igorbelianski-cyber
Copy link
Contributor

resolves #
docs dbt-labs/docs.getdbt.com/#

Problem

Solution

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

Add COPY GRANTS clause to CREATE OR REPLACE DYNAMIC TABLE DDL for both
info schema and iceberg dynamic tables, allowing users to preserve grants
when a dynamic table is replaced via full refresh.

Made-with: Cursor
Add support for the Snowflake dynamic table `scheduler` property, which
controls whether the internal refresh scheduler is ENABLE or DISABLE.
This is distinct from `scheduling_state` (ACTIVE/SUSPENDED), which is a
Snowflake-managed runtime status.

Key changes:

- Add `Scheduler` enum (ENABLE/DISABLE) and make `target_lag` optional
  in `SnowflakeDynamicTableConfig` to support scheduler=DISABLE without
  a target lag specification.

- Apply implicit scheduler defaults in both `parse_relation_config` and
  `parse_relation_results`: when scheduler is not explicitly set, default
  to ENABLE if target_lag is present, DISABLE otherwise. This aligns the
  Python-side change detection logic with the Jinja macro defaults.

- Add scheduler change detection in `dynamic_table_config_changeset` and
  prevent target_lag from being included in ALTER when its new value is
  None (avoids generating `target_lag = 'None'` in SQL).

- Update CREATE, REPLACE, and ALTER macros to render `scheduler` in DDL
  with correct ENABLE/DISABLE defaults. Guard ALTER target_lag rendering
  to skip when context is None.

- Update materialization to issue `ALTER DYNAMIC TABLE ... REFRESH` when
  scheduler is DISABLE (explicit or implicit via missing target_lag),
  since Snowflake won't auto-refresh in that case.

- Read the `scheduler` column from SHOW DYNAMIC TABLES when available.

- Fix FileSystemLoader in test_alter_relation_comment_macro.py to use an
  absolute path, avoiding TemplateNotFound errors from different CWDs.

- Add comprehensive unit tests for scheduler config parsing, changeset
  detection, and change detection logic, plus functional tests covering
  scheduler in CREATE/ALTER/REPLACE DDL and refresh behavior.

Made-with: Cursor
@igorbelianski-cyber igorbelianski-cyber requested a review from a team as a code owner March 3, 2026 22:35
@cla-bot
Copy link

cla-bot bot commented Mar 3, 2026

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-ibelianski

@igorbelianski-cyber igorbelianski-cyber marked this pull request as draft March 4, 2026 02:08
@igorbelianski-cyber igorbelianski-cyber changed the title Ibelianski snowflake dynamic table schedile singleton (TODO singleton) Ibelianski snowflake dynamic table schedile singleton (draft backup Mar 4, 2026
@igorbelianski-cyber igorbelianski-cyber changed the title Ibelianski snowflake dynamic table schedile singleton (draft backup (draft backup) Ibelianski snowflake dynamic table schedile singleton Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants