any tips on passing quoted string to the new cli c...
# integration-dbt
c
any tips on passing quoted string to the new cli command? it doesn't seem to be translating it properly
🤖 1
here's my code
Copy code
dbt_run_operation = dbt_cli.cli(
            args=[
                "run-operation",
                "stage_external_sources",
                "--args",
                rf"'select: {dbt_package_name}.{name}'",
                "--vars",
                r"'ext_full_refresh: true'",
            ],
            manifest=manifest,
            context=context,
        )
I just added the r"" so that might have been the problem, but before, it was throwing
[0m20:38:59 The YAML provided in the --args argument is not valid.
Error: Invalid value for '--args': String ''select: people.src_people__employee_numbers_archive'' is not valid YAML
r
Here’s what dbt recommends with vars: https://docs.getdbt.com/docs/build/project-variables#defining-variables-on-the-command-line It’s probably easier to do a
json.dumps
on a python dictionary so you’re not in the business of handcrafting raw strings.
Here’s what I mean: https://github.com/dagster-io/dagster/blob/master/examples/experimental/tutorial_dbt_dagster_v2/tutorial_dbt_dagster_v2/assets/partitions.py#L26
Copy code
dbt_vars = {"date": context.partition_key}
    dbt_args = ["run", "--vars", json.dumps(dbt_vars)]

    yield from dbt.cli(dbt_args, manifest=manifest, context=context).stream()
c
aha
the raw strings just worked btw, but I will try with
dumps
as well
👍🏽 1