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

[Feature] Optionally refresh dynamic tables when not rebuilding #1114

Closed
3 tasks done
chrisluedtke opened this issue Jul 11, 2024 · 6 comments
Closed
3 tasks done

[Feature] Optionally refresh dynamic tables when not rebuilding #1114

chrisluedtke opened this issue Jul 11, 2024 · 6 comments
Labels

Comments

@chrisluedtke
Copy link

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt-snowflake functionality, rather than a Big Idea better suited to a discussion

Describe the feature

I'd like to define a graph of dynamic tables and run them exclusively as a dbt command, rather than establishing a target lag and relying on Snowflake to schedule updates.

When I dbt run --select my_dynamic_table, I'd like this to happen if the table already exists and we're not in a full refresh scenario:

ALTER DYNAMIC TABLE my_dynamic_table REFRESH

Describe alternatives you've considered

No response

Who will this benefit?

Users with a mixture of tables, views, and dynamic tables who want to control model updates through an orchestrator like Airflow.

Are you interested in contributing this feature?

Yes

Anything else?

No response

@chrisluedtke chrisluedtke added enhancement New feature or request triage labels Jul 11, 2024
@amychen1776
Copy link

@chrisluedtke I'm curious to ask you what the use case here for your use of dynamic tables rather than say incremental. Is this to avoid writing incremental logic? Based on what I'm aware of, fundamentally you don't create a dynamic table without a target lag which means Snowflake is always refreshing it on a cadence anyways.

@chrisluedtke
Copy link
Author

@amychen1776 dynamic tables can be created with 'downstream' target lag and refreshed explicitly.

@amychen1776
Copy link

@chrisluedtke that's true but I'm curious why you want to use a dynamic table in this use case that is manually refreshed so I can better understand.

@chrisluedtke
Copy link
Author

@amychen1776 as I said in the original post, this would enable users to leverage a tool like airflow to schedule and monitor refreshes in a DAG that includes both dynamic tables and other types of model materialization. That makes it extremely simple to implement incremental updates alongside existing models and tech stacks. Additionally, dynamic tables have full support for deletions. The vanilla dbt incremental materialization cannot update a record that was excluded due to a data update (like a deletion or exclusion by a where clause or join condition).

@amychen1776
Copy link

Thank you for clarifying! Unfortunately, due to other priorities, we will not be able to support this on our roadmap at this time. That said, I would love to revisit this in the future.

@amychen1776 amychen1776 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2024
@kingalban
Copy link

I just want to clarify the current design and behaviour.
There is currently a macro snowflake__refresh_dynamic_table in dynamic_table/refresh.sql which would do the job, but it seems that it's never called?
Something similar is included in the test suite 🤔

It seems to me that this macro was meant to be used here dynamic_table.sql:43.

I fully understand your prioritisation, but I'm wondering if there was some obstacle to this originally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants