Manish Khatri
08/04/2023, 10:12 PMload_assets_from_dbt_project
to the new flexible way of building dbt assets from a dbt project using @dbt_assets
and DbtCliResource
like in this tutorial. Currently we use the following:
load_assets_from_dbt_project(
project_dir=DBT_PROJECT_DIR,
profiles_dir=DBT_PROFILES_DIR,
node_info_to_group_fn=get_dbt_group_name, -- prefixes the asset group name with "dbt_"
)
I’ve looked at the 1.4.14
docs and it’s not clear to me where we can specify an alternative profiles.yml
path in the new way:
@dbt_assets(manifest=dbt_manifest_path)
def jaffle_shop_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["run"], context=context).stream()
yield from dbt.cli(["test"], context=context).stream()
With regards to the node_info_to_group_fn
, is that now replaced with the kwarg of dagster_dbt_translator
in @dbt_assets(….)
? Where the value is a DagsterDbtTranslator object specifically like this example?Sean Lopp
08/04/2023, 10:17 PMManish Khatri
08/04/2023, 10:45 PM@dbt_assets(manifest=dbt_manifest_path)
def jaffle_shop_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["run" ,"--profiles-dir /my/custom/dir"], context=context).stream()
yield from dbt.cli(["test", "--profiles-dir /my/custom/dir"], context=context).stream()
I would expect that to output a valid CLI command that can be run.
I would like to avoid extending the main dagster cli class and try to keep things as “out the box” and vanilla as possibleSean Lopp
08/04/2023, 11:15 PMrex
08/04/2023, 11:33 PMManish Khatri
08/07/2023, 6:47 PMCustomDagsterDbtTranslator
example, that helped a lot. I should add that the example here would ideally need the @classmethod
decorator so it matches the exact same function body as DagsterDbtTranslator
otherwise mypy will complain when doing static type checking.rex
08/07/2023, 6:47 PM