File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040
4141 {% if any_refs %}
4242 {% set name = any_refs[0 ] %}
43- -- NOTE: This relies on snapshot models to include the word "snapshot" in the model name.
44- -- There doesn't seem to be an easily accessible field to tell us that this node is a snapshot
45- -- without relying on the name or other proxies.
46- {% if " snapshot" in name %}
43+ -- NOTE: This relies on snapshot models to include the word "snapshot" in the model name or
44+ -- the column `dbt_scd_id` to be included in the metadata kwargs (since this is a good proxy
45+ -- for this model being a snapshot given `dbt_scd_id` is an internal dbt field).
46+ -- There doesn't seem to be another, easily accessible field to tell us unambigously that this node is a snapshot
47+ {% set metadata_column_name = el .node .to_dict().get(' test_metadata' , dict()).get(' kwargs' , dict()).get(' column_name' ) %}
48+ {% if " snapshot" in name or metadata_column_name == " dbt_scd_id" %}
4749 {% set ref_type = " snapshot" %}
4850 {% else %}
4951 {% set ref_type = " model" %}
You can’t perform that action at this time.
0 commit comments