(draft backup) Ibelianski snowflake dynamic table schedile singleton#1709
Draft
igorbelianski-cyber wants to merge 2 commits intodbt-labs:mainfrom
Draft
Conversation
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
|
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #
docs dbt-labs/docs.getdbt.com/#
Problem
Solution
Checklist