Hey! Is there a way to add non-argument dependenci...
# integration-dbt
g
Hey! Is there a way to add non-argument dependencies to a dbt model config? I have a dagster asset that runs a snapshot for a specific table and a model that transforms the snapshots. I’d like for the freshness policy of the downstream to run the snapshot so I was hoping I could connect them like this. ty spinny
fyi this a snippet from my asset factory that generates the snapshot assets
Copy code
@asset
def _asset(context) -> DbtCliOutput:
    res = context.resources.dbt.cli(f"snapshot --select {table}_snapshot")
    return res
o
hi @Guy McCombe! interesting question -- all of the dependency information for dbt assets is loaded directly from the dbt project, so anything that is upstream of a dbt model needs to be represented as a source (see: https://docs.dagster.io/integrations/dbt/reference#upstream-dependencies). but I think you can trick dagster into understanding that dependency by adding the snapshot as a source to the relevant dbt model. You might have to do this in a comment to avoid confusing dbt, i.e. in `my_model.sql`:
Copy code
select * from foo
-- {{ source(my, snapshot) }}
but once that's done, dagster should understand that there's a dependency between my_model and my_snapshot
g
That worked perfectly! Thanks, @owen daggy love