From 751847c0f4ea74351c0aaa888c40dd06d6050170 Mon Sep 17 00:00:00 2001 From: JamieDeMaria Date: Thu, 14 Sep 2023 12:12:09 -0400 Subject: [PATCH] update dbt examples and internal context to align with AssetExecutionContext --- .../dagster-dbt/dagster_dbt/core/resources_v2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python_modules/libraries/dagster-dbt/dagster_dbt/core/resources_v2.py b/python_modules/libraries/dagster-dbt/dagster_dbt/core/resources_v2.py index b540dbeee8331..2605ef0340055 100644 --- a/python_modules/libraries/dagster-dbt/dagster_dbt/core/resources_v2.py +++ b/python_modules/libraries/dagster-dbt/dagster_dbt/core/resources_v2.py @@ -562,7 +562,7 @@ def _get_unique_target_path(self, *, context: Optional[AssetExecutionContext]) - unique_id = str(uuid.uuid4())[:7] path = unique_id if context: - path = f"{context.op.name}-{context.run_id[:7]}-{unique_id}" + path = f"{context.op_execution_context.op.name}-{context.run_id[:7]}-{unique_id}" return f"target/{path}" @@ -735,8 +735,8 @@ def my_dbt_op(dbt: DbtCliResource): selection_args = get_subset_selection_for_context( context=context, manifest=manifest, - select=context.op.tags.get("dagster-dbt/select"), - exclude=context.op.tags.get("dagster-dbt/exclude"), + select=context.op_execution_context.op.tags.get("dagster-dbt/select"), + exclude=context.op_execution_context.op.tags.get("dagster-dbt/exclude"), ) else: manifest = validate_manifest(manifest) if manifest else {} @@ -796,7 +796,7 @@ def get_subset_selection_for_context( # TODO: this should be a property on the context if this is a permanent indicator for # determining whether the current execution context is performing a subsetted execution. - is_subsetted_execution = len(context.selected_output_names) != len( + is_subsetted_execution = len(context.op_execution_context.selected_output_names) != len( context.assets_def.node_keys_by_output_name ) if not is_subsetted_execution: @@ -807,7 +807,7 @@ def get_subset_selection_for_context( return default_dbt_selection selected_dbt_resources = [] - for output_name in context.selected_output_names: + for output_name in context.op_execution_context.selected_output_names: dbt_resource_props = dbt_resource_props_by_output_name[output_name] # Explicitly select a dbt resource by its fully qualified name (FQN).