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

Greg Bernard

07/19/2023, 5:21 PM
Hi Team, Trying to use the DBT CLI resource as shown in the docs here, but suddenly running into a ton of breaking issues: https://docs.dagster.io/_apidocs/libraries/dagster-dbt#resources-dbt-core It doesn't seem to have a
test
method implemented which is required by the built-in test Op
Copy code
dagster._core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "dbt_test_op":
The above exception was caused by the following exception:
AttributeError: 'DbtCli' object has no attribute 'test'
Using the built-in
full_refresh
run config also tries to apply the flag to the CLI as
--full_refresh
instead of
--full-refresh
which returns an error when trying to run models.
According to the docs
DbtCliResource
was deprecated in favour of
DbtCli
, However in the base the former seems to already be removed?
What's going on here, what should I be using?
Example run config returning the full refresh error
Copy code
ops:
  run_dbt_0b7e2:
    config:
      full_refresh: true
https://github.com/dagster-io/dagster/blob/89d41d71fb271c914e9c4e149c6187e005ec745[…]/python_modules/libraries/dagster-dbt/dagster_dbt/asset_defs.py According to the doc_string here the behaviour of passing in the python args directly to the CLI is causing this to break.
Copy code
"""Keyword arguments to pass to the underlying dbt command. Additional arguments not listed in the schema will
    be passed through as well, e.g. {'bool_flag': True, 'string_flag': 'hi'} will result in the flags
    '--bool_flag --string_flag hi' being passed to the dbt command.
    """
Copy code
Usage: dbt build [OPTIONS]
Try 'dbt build -h' for help.

Error: No such option: --full_refresh Did you mean --full-refresh?
c

claire

07/19/2023, 6:17 PM
@rex would you mind taking a look at this question?
g

Greg Bernard

07/20/2023, 1:51 PM
Managed to get around this by passing
full-refresh: true
to the run config, but this is not the documented way it should work.
r

rex

07/20/2023, 2:27 PM
Hi Greg, this was an oversight. We can get
DbtCliResource
(formerly known as
DbtCli
) to work with the existing out of the box ops. In general, if you want to use the resource, we recommend that you just create your own `@op`’s that invoke
DbtCliResource
since it gives you more control. There was an issue with this in the current release, but it was fixed this week with our 1.4.0 release.
g

Greg Bernard

07/20/2023, 4:41 PM
Does this also fix the run-time config?
2 Views