[dagster-dbt] update usage of deprecated context methods #19806
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary & Motivation
Some methods in the dbt integration use context methods that were deprecated in #19441 and #17339. The op-specific methods are meant to be replaced by calling
context.op_execution_context.op
rather thancontext.op
. However, in some of the dbt methods, we don't know if the context is of typeAssetExecutionContext
orOpExecutionContext
, so it is unclear if we need to call the underlyingop_execution_context
before op-specific methods.This PR adds a check in some methods that will pull the
op_execution_context
from the context if the context is anAssetExecutionContext
so that we are guaranteed to be working with anOpExecutionContext
in the rest of the method.How I Tested These Changes