Hi all! I am using the dagster-dbt integration. I ...
# ask-community
t
Hi all! I am using the dagster-dbt integration. I have some python scripts declared as assets, as well as dbt models declared as assets. (the usual integration step). I am having trouble creating dependencies between my python assets and dbt assets. So instead I was wondering if it is possible to create the dependency between asset jobs? i.e something like: JobA = define_asset_job(name="JobA", Selection=[PythonAssets]) JobB = define_asset_job(name="JobB", Selection=[dbtAssets], deps=JobA) Is something like this possible?
r
As I understand it dbt models can only declare dependencies within dbt, not when declaring the assets in dagster. I made a dependencies in dbt to a table that I have as a source. That source then has a meta->dagster->asset_key set and also same asset-key defined as an asset in dagster. Dagster will identify that as being upstream from any dbt models I use that table in. Now my non-dbt asset will be materialised before any dbt models dependent on them. I got the inspiration from here https://github.com/dagster-io/dagster/issues/9575 But the key is that you can only define dependencies to a dbt model in the dbt project.
t
Thanks Roger! I made it work that way aswell. Problem is now that the dependency between the two python assets doesnt show in the asset job. Work around by grouping my 2 python assets into 1, but ideally i want them split up so they can be run individually.
r
Isn’t it possible to do something like this @asset def asset1() …. @asset(deps=[asset1]) def asset2() …. That way asset 2 has a dependency to asset 1
t
That's what i did initially. But it seems that deps isn't being inherited in my asset job somehow.. I created asset2() (from your example) as a dbt source which works. Maybe I am referencing asset2() wrong?
r
Above would apply to deps between your python code assets