https://dagster.io/ logo
#integration-dbt
Title
# integration-dbt
g

Graham Wetzler

02/08/2023, 10:11 PM
Hey everyone, is it possible to create an
op
that is automatically run downstream of a dbt model based on the presence of a meta tag?
n

Nicolas Parot Alvarez

02/09/2023, 3:23 PM
Is the meta tag, a Dagster job run tag? You can retrieve successful job runs for specific tags like this:
Copy code
context.instance.get_runs(
            RunsFilter(
                job_name=your_job.name,
                tags={"your_tag_name": your_tag_value}, 
                statuses=[DagsterRunStatus.SUCCESS],
            ),
        )
So you could have a sensor that will monitor the refresh of your DBT model (job status sensor or asset sensor) and if there's a new run for the specific tag, request a run for the job that contains your op. I think you could use the run's
run_id
as the RunRequest
run_key
so you don't request your op to run more than once for the same run.
g

Graham Wetzler

02/09/2023, 3:42 PM
The meta tag is part of the dbt manifest node https://docs.getdbt.com/reference/resource-configs/meta
n

Nicolas Parot Alvarez

02/09/2023, 4:46 PM
Ok, so not a Dagster tag. Then you'd need a way to retrieve the DBT asset's meta field in the context of a sensor.
5 Views