-
Notifications
You must be signed in to change notification settings - Fork 181
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
[ADAP-544] [Feature] Support Dynamic Tables as a materialization (following base Materialized View ergonomics) #603
Comments
@Fleid Do we actually store the 'lag' parameter in Snowflake anywhere? If not, I don't know how I'd track that and apply the effects of Alternatively, it seems like this might not be something that we would need to store, and really is just a way to augment how dbt deploys the dynamic table changes. In other words, if nothing else has changed, in particular the |
@mikealfare You can see the target lag via |
Snowflake is renaming this to TARGET_LAG (though LAG will still work for compatibility)
DTs also support a manual refresh operation (in 7.19, early June). Invoking that would be more convenient than waiting for the schedule to kick it off. |
Hey @sfc-gh-dsotolongo! Thanks for stopping by ;) @mikealfare we should rename |
This got closed via automation but there is still more development on it. |
Yay automation |
I tried the dynamic table implementation it works great! Thanks for doing it! If i'm not wrong the parameter for the warehouse is |
That's correct. We already had a parameter for warehouse (called |
Hi. Is there any documentation on how to create DTs using dbt? |
@cherns31 We have our our configuration docs and we have a developer blog |
It's weird bc I don't find this topic at the configuration docs. |
@cherns31 Are you viewing the docs for an older version of dbt? There's a dropdown at the top of the page that needs to be set to 'v1.6' for the Dynamic Tables documentation to be visible at the link @amychen1776 sent. |
Oh yes, my bad 😊 |
Is there any official documentation on dbt docs? Did the materialization make it to a release? |
@sfc-gh-pkommini These docs may need to be updated with the 1.7.0 release that went out yesterday, but here's a link. Dynamic tables have been in since |
Apologies if I am missing it, but did/will the |
@wylbee I created an issue to capture this and break it out of this feature: #859. At the moment, I don't believe a Snowflake user can create a dynamic table (through dbt or otherwise) without also executing the logic and populating the table. But if Snowflake ever adds that functionality, then this feature becomes possible. |
For more context about Dynamic Tables (DTs), see this post.
materialized: dynamic_table
This issue is the local implementation of the core feature: Let's add Materialized View as a materialization, finally.
The original spec is the baseline. In every aspect it's the same feature, with the exceptions described below.
Alias
The local alias for this materialization is
dynamic_table
, notmaterialized_view
. The later is not supported and should return an error (to avoid confusion with Snowflake's MVs)Schema management
Metadata caching/querying should be updated to add the following sources in order to support Dynamic Tables:
SHOW DYNAMIC TABLES
- docDESCRIBE DYNAMIC TABLE
- docConfigurations
Available parameters:
LAGTARGET_LAG : string (<num> { seconds | minutes | hours | days }
)no_wait
,refreshed
}Refresh strategy is described below.
Out of scope for the moment (not clear yet if applicable): copy_grants, persist_docs, clustering management
Lifecycles
dbt run
) :CREATE OR REPLACE DYNAMIC TABLE
(doesn't exist) and apply refresh_strategy ElseFAILED
thenCREATE OR REPLACE DYNAMIC TABLE
and apply refresh_strategy Elseon_configuration_change
skip
: Do nothing, aka stage changes until the next full refreshfail
: Fail the runapply
: [default] Apply the changesdbt run --full-refresh
) :OR exists and full-refresh)CREATE OR REPLACE DYNAMIC TABLE
and apply refresh_strategyStatus check
The refresh status of a DT is obtained via the following query:
The return code is a string among:
Refresh strategy
To ensure downstream models are able to query the DT in a proper state, dbt may have to wait for the DT to be successfully refreshed before moving on. The
refresh_strategy
setting offers 2 options:no_wait
refresh
SUCCEEDED
state, polling every few seconds its statusIn order to avoid waiting indefinitely, in
refresh
mode, the polling will stop and the run will fail when:SCHEDULED, EXECUTING
is returnedThe text was updated successfully, but these errors were encountered: