https://dagster.io/ logo
#integration-dbt
Title
# integration-dbt
m

mohammad naghibi

08/13/2023, 7:36 AM
Hi all how should I define the "@dbt_assets" in Definitions my code is:
@dbt_assets(_manifest_=Path("/dbt/target","manifest.json"))
def my_dbt_assets(
_context_: OpExecutionContext, _dbt_: DbtCliResource):
yield from
_dbt_.cli(["run"], _context_=_context_).stream()
dbt_test_invocation =
_dbt_.cli(["test"], _context_=_context_)
_if_ not dbt_test_invocation.is_successful():
_raise_ Exception("my exception")
dbt_job = define_asset_job("dl_dw_dbt_job", _selection_="my_dbt_assets")
🤖 1
r

rex

08/14/2023, 1:53 PM
The tutorial answers questions like this. Did you finish it? https://docs.dagster.io/integrations/dbt/using-dbt-with-dagster/load-dbt-models You’ll want
Copy code
Definitions(
    assets=[my_dbt_assets]
)
m

mohammad naghibi

08/15/2023, 5:57 AM
Thank you I konw this, but I get this error when write like you answered "dagster._check.CheckError: Member of iterable mismatches type. Expected (<class 'dagster._core.definitions.assets.AssetsDefinition'>, <class 'dagster._core.definitions.source_asset.SourceAsset'>, <class 'dagster._core.definitions.cacheable_assets.CacheableAssetsDefinition'>). Got [<dagster._core.definitions.assets.AssetsDefinition object at >] of type <class 'list'>."
r

rex

08/15/2023, 1:16 PM
you’re either including an extra set of brackets, or you’re not actually using
@dbt_assets
and are mistakenly using
load_assets_from_dbt_project
or
load_assets_from_dbt_manifest
. If you’re using
@dbt_assets
, It should be
[my_dbt_assets]
, not
[[my_dbt_assets]]
m

mohammad naghibi

08/16/2023, 6:11 AM
thank you D
3 Views