You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spike on whether we can clean up this code by leveraging the clone macro / materialization that we developed for v1.6
If we can get to cleaner code that's supported across DWHs, it's then just a UX question of whether this is enabled/disabled via yaml config (option 2) or post-hook (option 3)
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
[Spike] Can the hook for latest model version unsuffixed view/clone leverage our clone macro/materialization?
[CT-2832] [Spike] Can the hook for latest model version unsuffixed view/clone leverage our clone macro/materialization?
Jul 18, 2023
Thanks to @mikealfare's work, we can simplify the macro in the documentation to the following:
{% macro create_latest_version_view() %}
-- this hook will run only if the model is versioned, and only if it's the latest version-- otherwise, it's a no-op
{% if model.get('version') andmodel.get('version') ==model.get('latest_version') %}
{% set target_relation =this.incorporate(path={"identifier": model['name']}) %}
{% do log("Creating view " ~ target_relation ~ " pointing to " ~ this, info = true) if execute %}
{{ return(get_replace_view_sql(target_relation, "select * from {{ this }}")) }}
{% else %}
-- no-opselect1as id
{% endif %}
{% endmacro %}
I think this resolves the spike @jtcohen6, what should the next steps here be?
spike split out of #7442
We have documented/recommended some code for an opt-in post-hook, that creates an extra view pointing to the "latest" object: https://docs.getdbt.com/docs/collaborate/govern/model-versions#configuring-database-location-with-alias
Definition of done:
If we can get to cleaner code that's supported across DWHs, it's then just a UX question of whether this is enabled/disabled via yaml config (option 2) or post-hook (option 3)
The text was updated successfully, but these errors were encountered: