r/DataBuildTool • • Oct 07 '26

Question Snapshot redesign

I’m fairly new to DBT. Please help me and be kind enough to answer my question.

I need to redesign the existing flow, creating a snapshot model(which is not done right).

We have existing flow like this

Raw1–> snapshot1–>dim1–✒️
dim
Raw2–>snapshot2–>dim2-🖊️

From the above flow we are missing direct history tracking and goal is to create common snapshot for final dimension by eliminating dim1 and dim 2

Also, currently airflow run dependency had set like after snapshot dag run completion dim dag will start.

And project folder is as follows
-model
|_dags
|_bronze
|_silver
|_gold
|_consumer
-snapshots

If anybody has any idea about how to proceed in this case please help. TIA

3 Upvotes

9 comments sorted by

1

u/kittehkillah Oct 07 '26

I dont understand what you mean by its not correctly tracking history if your snapshot is on top of raw. A bit lacking in the details but that shouldn't be the problem i presume. Is it not more a misconfiguration somehow?

1

u/Maste_r11 Oct 07 '26

In order to trace back a particular event I need to join both the snapshot models, instead of need to build single snapshot before dim

1

u/kittehkillah Oct 07 '26

That doesnt sound like a snapshot problem but more like you have a snowflake set up? Are you wanting to only have 1 dim instead of doing a fact - > dim - > dim? Is this what you mean?

If it is, the snapshots dont really have anything to do with this. Snapshots are just a copy of your raw data overtime and nothing more

1

u/Maste_r11 Oct 07 '26

Of course it’s a copy of raw data but we wanted to have a single snapshot model ref inside the dim model instead of two. With that easy to apply dbt_valid_to is NULL condition, it is easy to backtrack when an issue arrives.

1

u/kittehkillah Oct 07 '26

I really don't think this is a snapshot problem

The scenario youre describing, you cam go either one of 2 scenarios. 1, you do a row valid to is null after the snapshot then you combine the two tables, then youd have a dim that is always carrying the latest upto date information, in that scenario you dont even need to think about adding the row valid to filter. But (2) if you want history on the combination of the two tables then you have a problem because there is a big chance that those 2 tables carry different timestamps and itll be overcomplicated to combine them. Its possible but its so complex that youd rather just have 2 tables. And in the end, a query on 2 dims adding a row valid to filter isnt even bad

1

u/kittehkillah Oct 07 '26

Plus if you understand that snapshots are a layer of raw data... And you have 2 tables of raw data... Then there is no point in combining into 1 snapshot? I dont think it even makes sense unfortunately 

1

u/kittehkillah Oct 07 '26

If my above statement is true, i think what you might actually be wanting to do is create an intermediate table after the snapshots that combines the two raw tables, and that becomes your unified dim table

1

u/flodex89 Oct 07 '26

But they do share the same business key? I don't see the issue then?

1

u/vegemite-on-toast- Oct 07 '26

I think you’re trying to move from a hacked together system where you’re using two scd type 1 snapshots to build an scd type 2 view i.e. where you can model the change history.

If that’s correct, research those terms (scd 1&2) and what best practice looks like for scd 2 dimensions. You may need to adjust how you’re ingesting the data, so it’s not just storing snapshots.