From 03c57d7b7202e182a8411bab0edc019f6864314f Mon Sep 17 00:00:00 2001 From: Owen Kephart Date: Thu, 19 Dec 2024 16:13:38 -0500 Subject: [PATCH] [dagster-dbt][refactor] Use AssetOut.from_spec() to create AssetOuts for dbt_assets decorator --- .../dagster-dbt/dagster_dbt/asset_utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py b/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py index 68fdaea3e2629..8fa78c1a77812 100644 --- a/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py +++ b/python_modules/libraries/dagster-dbt/dagster_dbt/asset_utils.py @@ -25,6 +25,7 @@ AssetOut, AssetsDefinition, AssetSelection, + AssetSpec, AutoMaterializePolicy, AutomationCondition, DagsterInvalidDefinitionError, @@ -807,12 +808,9 @@ def build_dbt_multi_asset_args( project=project, ) - outs[output_name] = AssetOut( + spec = AssetSpec( key=asset_key, - dagster_type=Nothing, - io_manager_key=io_manager_key, description=dagster_dbt_translator.get_description(dbt_resource_props), - is_required=False, metadata=metadata, owners=dagster_dbt_translator.get_owners( { @@ -832,6 +830,14 @@ def build_dbt_multi_asset_args( dbt_resource_props ), ) + if io_manager_key: + spec = spec.with_io_manager_key(io_manager_key) + + outs[output_name] = AssetOut.from_spec( + spec=spec, + dagster_type=Nothing, + is_required=False, + ) test_unique_ids = [ child_unique_id