Hi, what is the correct way to pass a `--full-refr...
# integration-dbt
Hi, what is the correct way to pass a
flag via the LaunchPad configuration for the new dbt Resource questiongif I would like to run that against a specific dbt model. The old resource had a
flag that could be set to
Passing it to the
does not work as the CLI command becomes
dbt --full-refresh run …..
which is incorrect syntax and raises an error from the dbt CLI
See the example use of pythonic
in the API reference:
Copy code
from pathlib import Path

from dagster import Config, OpExecutionContext
from dagster_dbt import DagsterDbtTranslator, DbtCliResource, dbt_assets

class MyDbtConfig(Config):
    full_refresh: bool

@dbt_assets(manifest=Path("target", "manifest.json"))
def my_dbt_assets(context: OpExecutionContext, 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()
You can provide a default of
here as well and only override manually from the launchpad
🙌 1
you can probably customize the dbt resource with something like this
Copy code
class DbtCustomCliResource(DbtCliResource):
    full_refresh: bool = False

    def cli(self, args: List[str], *, context: Optional[OpExecutionContext] = None):

        if self.full_refresh:
            args = [*args, "--full-refresh"]

        return super().cli(args=args, context=context)
🙌 1
Here's a discussion with an answer: https://github.com/dagster-io/dagster/discussions/8873 cc @rex in case the discussion needs an update with the latest changes