https://prefect.io logo
Title
s

Stephen Lloyd

04/10/2023, 9:22 AM
When attempting to use
DbtCoreOperation
we are receiving the following error... This suggests that our dbt cli profile block, which we have defined in dbt Cloud, does not have a name or target or target_configs, but it does..
pydantic.error_wrappers.ValidationError: 3 validation errors for DbtCoreOperation
dbt_cli_profile -> name
  field required (type=value_error.missing)
dbt_cli_profile -> target
  field required (type=value_error.missing)
dbt_cli_profile -> target_configs
  field required (type=value_error.missing)
I was able to use the
profile_dir
parameter to use my local credentials, but this only verifies there aren't obvious problems with the flow code.
prefect-dbt==0.3.1
prefect-snowflake==0.26.0
Any ideas?
upgrading to 0.26.1 didn't help
I think I found the problem. It looks like the documentation is incorrect. From the docs
snowflake_connector = await SnowflakeConnector.load("snowflake-connector")
target_configs = SnowflakeTargetConfigs(connector=snowflake_connector)
dbt_cli_profile = DbtCliProfile(
    name="jaffle_shop",
    target="dev",
    target_configs=target_configs,
)
profile = dbt_cli_profile.get_profile()
dbt_init = DbtCoreOperation(
    commands=["dbt debug", "dbt list"],
    dbt_cli_profile=dbt_cli_profile,
    overwrite_profiles=True
)
dbt_init.run()
Specifically
profile = dbt_cli_profile.get_profile()
is wrong. DbtCoreOperation uses
get_profile()
internally, so we shouldn't use it before passing the profile in. cc: @Susan Joshi @Emil Christensen I'm sending a support email to ask for a fix, but where would I do this without the support email.
👀 1
r

Rob Freedy

04/10/2023, 1:29 PM
Hey @Stephen Lloyd!! We'll follow up in the support case, but typically bugs/doc correction issues can be filed on the prefect-dbt git repo.
s

Sean Williams

04/10/2023, 11:35 PM
@Stephen Lloyd without seeing exactly the errors you were getting, I think I was able to recreate the issue. I'll create a github issue and work on a PR. Thanks for spotting this!
s

Stephen Lloyd

04/11/2023, 6:23 AM
@Rob Freedy, I couldn't find where the docs were at in the repo and didn't want to spend too long figuring it out.
r

Rob Freedy

04/11/2023, 1:45 PM
@Stephen Lloyd I believe the docs are generated automatically from the Docstrings of the classes and functions in that repo, so I believe this line would have to be changed. I have created a PR here from a fork, feel free to add anything I missed.
s

Stephen Lloyd

04/12/2023, 5:00 AM
Thanks! I'll open a PR that way next time.
👍 1