Skip to content

How do I define a method using dbt.cli that dynamically executes a dbt command? #21639

Discussion options

You must be logged in to vote

You should try setting out={}.

- @op(required_resource_keys={"dbt"}, out=Out(Nothing))
+ @op(required_resource_keys={"dbt"}, out={})
def dbt_cli_op(context: OpExecutionContext, dbt_command: str, dbt_select: str, dbt_exclude: str=None):
    dbt_cli_cmd = [dbt_command, "--select", dbt_select]
    if dbt_exclude:
        dbt_cli_cmd.extend(["--exclude", dbt_exclude])
    yield from context.resources.dbt.cli(dbt_cli_cmd, manifest=dbt_manifest_path, dagster_dbt_translator=CustomDagsterDbtTranslator).stream()

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@emilee-jurkowski
Comment options

@rexledesma
Comment options

@emilee-jurkowski
Comment options

@rexledesma
Comment options

@emilee-jurkowski
Comment options

Answer selected by emilee-jurkowski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
integration: dbt Related to dagster-dbt
2 participants