D Zavadskykh
08/28/2023, 8:19 AMTodd de Quincey
08/28/2023, 9:00 AMdbt
sources file.
Personally, I don’t go down this approach (i.e. defining Dagster dependencies inside my dbt project), as I like to keep Dagster logic inside of Dagster and dbt as a stand alone element which has no knowledge of Dagster. But this is the documented way 🙂
https://docs.dagster.io/integrations/dbt/using-dbt-with-dagster/upstream-assets#step-3-in-the-dbt-project-replace-a-seed-with-a-sourceD Zavadskykh
08/28/2023, 9:16 AMTodd de Quincey
08/28/2023, 9:19 AMDagsterDbtTranslator
then and override the get_metadata
method.
So if in a simplified example, all 500 models depended on Asset A, then you could update the meta data at the translator level.
https://docs.dagster.io/_apidocs/libraries/dagster-dbt#dagster_dbt.DagsterDbtTranslator.get_metadataD Zavadskykh
08/28/2023, 9:33 AMD Zavadskykh
08/28/2023, 12:53 PMget_metadata
is only for display purposes in the UI.rex
08/28/2023, 1:23 PMget_metadata
is only for display purposes.
You could just run your migration script before your materializing your dbt assets:
@dbt_assets(...)
def my_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
# run migration script
yield from dbt.cli(["run"], context=context)
rex
08/28/2023, 1:26 PMD Zavadskykh
08/28/2023, 1:32 PMrex
08/28/2023, 1:36 PM