Hi all how should I define the "@dbt_assets" in De...
# integration-dbt
m
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
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
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
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
thank you D