https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Son Giang

06/21/2022, 8:54 AM
How can I run dbt assets with parameters/variables?
🤖 1
s

sandy

06/21/2022, 6:46 PM
Hi Son - how would you want to supply these? When you hit the "Materialize" button?
s

Son Giang

06/22/2022, 3:26 AM
Right now I’m doing ingestion partitioned by day, once a partition of the ingestion finished, I want to pass the (start_time, end_time) as variables into dbt assets to run incrementally. Can you suggest the best way to do it?
s

sandy

06/24/2022, 9:11 PM
Got it - that makes sense. If I understand correctly, you'd want your schedule to set the dbt vars? If so, you could do something like this, assuming you're using the dbt_cli_resource:
Copy code
@schedule(job=my_asset_job)
def my_schedule(context):
    start_time = context.scheduled_execution_time
    return {"resources": {"dbt": {"config": {"vars": {"start_time": start_time.format(...)}}}}}}
Btw here's an issue to track adding more direct support for dbt & partitions, if you haven't seen it already: https://github.com/dagster-io/dagster/issues/7683.