-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Thanks @dbeatty10 @joellabes for working through this with me!
As the producer of a versioned model, I want the unsuffixed database relation (<db>.<schema>.<model_name>) to always point to the latest version of that model. This provides downstream consumers with the same optionality that's available to ref: "pin" to a specific version (suffix), or "unpin" (no suffix) and always get the latest.
dbt should handle this for me, by creating an additional "pointer" view (select * from <latest>) or table clone (depending on the relation type and data platform support) whenever I run the latest version of my model.
Implementation options
I'm not in love with any of these options:
- Create a new node in the manifest with this logic, materialized as a view (or clone?). Not sure if/how we'd be able to set configurations on that additional node/object (e.g. persisting descriptions).
- Update the view, table, and incremental materializations to produce an additional relation, if the model is versioned (and this is the latest version)
- Provide users with a macro that they can "set and forget" as a model
post-hook
Of those, (3) is the least magical, and it's what we'll propose to users in the short term (v1.5). We still don't like:
- Hooks in general, and especially hooks that run DDL to create database objects
- Lacking the robustness of an actual materialization
- Requiring users to copy-paste a macro and update their project, when this is the Right Behavior that should just happen out of the box
- Making the proposed logic for schema management more complicated