Snapshot check strategy with valid from date

I have a scenario where I need to create a snapshot of a source entity which does not have a timestamp that can reliably be used to indicate a change in that entity, so I am using the “check” strategy and this works fine.

The check strategy always uses the current timestamp for dbt_valid_from for new rows, however in this scenario there is a parent entity that has a “last updated” date that I need to use for new rows instead of the current timestamp. This column is present in the source data, although as it comes from the parent entity instead it can’t be used reliably to indicate changes in the source entity, but when there are changes then it can be used as the start date for those changes.

Ideally I’d like to have some way to pass in the name of a column in the source data that contains the value to use for dbt_valid_from for new rows. Is there any way to do this apart from creating custom versions of the snapshot materialization and associated macros? I’m hesitant to introduce too much custom code into the solution as we’re fairly new to dbt.

1 Like

I wish you got an answer to your question as I have an exact same requirement. I want to use my own date that comes from the data source to populate the dbt_valid_from field in the target table.

1 Like