Getting the fully qualified database table name from upstream dbt asset #25175
Unanswered
the4thamigo-uk
asked this question in
Q&A
Replies: 1 comment
-
Hey @the4thamigo-uk - the fully qualified name of a dbt model is included in its materialization metadata with the key “dagster/table_name”. You can access it in a downstream asset using the following code: from dagster import AssetExecutionContext, AssetKey, asset
@asset
def my_downstream_asset(context: AssetExecutionContext, my_upstream_dbt_asset):
event = context.instance.get_latest_materialization_event(AssetKey("my_upstream_dbt_asset"))
table_name = event.asset_materialization.metadata["dagster/table_name"].value |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I have a non-dbt asset (A) that depends on a dbt asset (B), how can I obtain the full name of the database artifact (i.e. the relation), so I can use it a SQL query called by B.
Beta Was this translation helpful? Give feedback.
All reactions