Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add refresh_mode and initialize as dynamic table options #1081

Merged
merged 19 commits into from
Jun 20, 2024

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented Jun 12, 2024

resolves #868

This PR continues @HenkvanDyk's work in #893.

Note

We are not adding commment here since that is already managed via the standard config description. We'll make sure that the docs reflect this.

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

@mikealfare mikealfare marked this pull request as ready for review June 13, 2024 23:44
@mikealfare mikealfare requested a review from a team as a code owner June 13, 2024 23:44
@mikealfare mikealfare marked this pull request as draft June 14, 2024 16:07
@mikealfare mikealfare marked this pull request as ready for review June 14, 2024 18:11
@mikealfare mikealfare marked this pull request as draft June 14, 2024 20:31
@mikealfare mikealfare changed the title Add refresh_mode, initialize, and comment as dynamic table options Add refresh_mode and initialize as dynamic table options Jun 14, 2024
@jtcohen6 jtcohen6 added the user docs [docs.getdbt.com] Needs better documentation label Jun 17, 2024
@@ -1,8 +1,16 @@
{% macro snowflake__get_create_dynamic_table_as_sql(relation, sql) -%}

{%- set dynamic_table = relation.from_config(config.model) -%}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the RelationConfig allows us to easily incorporate input validation for refresh_mode and initialize. If we're doing that, we should pull all attribution from this class, hence updating target_lag and snowflake_warehouse.

{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) %}
{% macro snowflake__get_replace_dynamic_table_sql(relation, sql) -%}

{%- set dynamic_table = relation.from_config(config.model) -%}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same comment as for snowflake__get_create_dyanmic_table_sql.

as (
{{ sql }}
)
;
{{ snowflake__refresh_dynamic_table(relation) }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now handled via the initialize parameter. Since initialize defaults to ON_CREATE, this is consistent with the current behavior.

@mikealfare mikealfare marked this pull request as ready for review June 17, 2024 16:00
@mikealfare mikealfare marked this pull request as draft June 20, 2024 17:38
@mikealfare mikealfare marked this pull request as ready for review June 20, 2024 17:39
@mikealfare mikealfare merged commit ff46cde into main Jun 20, 2024
18 checks passed
@mikealfare mikealfare deleted the dynamic-table-parameters branch June 20, 2024 19:07
@FishtownBuildBot
Copy link
Collaborator

Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#5678

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ADAP-1076] [Feature] [Dynamic Tables] Add new parameter properties (REFRESH_MODE, INITIALIZE)
5 participants