https://dagster.io/ logo
Title
t

Todd Hendricks

12/19/2021, 11:10 PM
Hi all, forgive me if I missed this in the docs, but I'm using the dagster-dbt API, and I would like to consume the output of one of my models within a Job. Is that possible? Any guidance would be greatly appreciated.
m

Manny Schneck

12/19/2021, 11:16 PM
What do you mean by this? Do you want to query the model and use the results in the job?
1
Do you want to express a "run this job, after this side-effectful action, which does not produce output, has run" dependency?
One sec, resolving docs link from my brain.
from dagster import In, Nothing, job, op


@op
def create_table_1():
    get_database_connection().execute("create table_1 as select * from some_source_table")


@op(ins={"start": In(Nothing)})
def create_table_2():
    get_database_connection().execute("create table_2 as select * from table_1")


@job
def nothing_dependency():
    create_table_2(start=create_table_1())
I'm using this a lot.
t

Todd Hendricks

12/19/2021, 11:18 PM
Thanks Manny!
m

Manny Schneck

12/19/2021, 11:18 PM
My org hasn't approved DBT, so I'm running bigquery jobs as dagster steps lol.
It works ok.