How to run different dbt commands for the same assets #20769
-
Sorry, not entirely sure how to word this, so perhaps an example better illustrates this. If I'm not mistaken, the asset definitions via the Now, I've seen in the documentation this example: from pathlib import Path
from dagster import AssetExecutionContext, Config
from dagster_dbt import DbtCliResource, dbt_assets
class MyDbtConfig(Config):
full_refresh: bool
@dbt_assets(manifest=Path("target", "manifest.json"))
def data_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource, config: MyDbtConfig):
dbt_build_args = ["build"]
if config.full_refresh:
dbt_build_args += ["--full-refresh"]
yield from dbt.cli(dbt_build_args, context=context).stream() I assume this does the job when running jobs in the UI, however, I can't workout how I can schedule two jobs that act on the same set of assets, but:
These models are simply partitioned, i.e. the cursor is derived from the underlying data, not passed as a parameter--I also don't intend to change this for now as it would take considerable time. One solution, which I dislike, was to bake into the asset definition (the function decorated with the What I really need, is some ability to configure a job. The job can run the same asset selection, but if some context can be passed through to the asset definition, then we could append the Any help would be appreciated as this feels like a blocker in using the integration at present. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
When using See a related discussion in #18803 (comment). |
Beta Was this translation helpful? Give feedback.
When using
define_asset_job
to define a job for a set of assets, you can pass aRunConfig
to theconfig
that lets you specify theMyDbtConfig
that you want when the job runs.See a related discussion in #18803 (comment).