Hi everyone! Just getting started with orchestrati...
# ask-community
m
Hi everyone! Just getting started with orchestrating DBT (CLI) flows using Prefect. Having a weird error where the "trigger_dbt_cli_command" is telling me I'm specifying an invalid project directory because I'm missing a dbt_project.yml file (I'm not). Any idea what's going on? Sample code below:
Copy code
from prefect import flow
from prefect_dbt.cli.commands import trigger_dbt_cli_command

@flow
def run_dbt() -> str:
    result = trigger_dbt_cli_command("dbt run", project_dir='C:\\Users\\36350admin\\arrow_dbt-1')
    return result

run_dbt()
It even tells me it's running this dbt command, and when I run that by itself in the same working directory, it works as expected!
22:29:08.084 | INFO    | Task run 'trigger_dbt_cli_command-321ca940-0' - Running dbt command: dbt run --profiles-dir C:\Users\36350admin\.dbt --project-dir C:\Users\36350admin\arrow_dbt-1
1
j
I wonder if this isn’t a Windows path parsing issue. See discussion today here that@Andrew Huang worked on. https://prefect-community.slack.com/archives/CL09KU1K7/p1664294315149279
a
Are you able to run
dbt debug
?
m
@Andrew Huang I just ran
dbt debug
as well as specified my profiles_dir param - and the paths that Prefect is returning are all messed/not valid paths at all.
Copy code
Using profiles.yml file at C:\Users\36350admin\prefect\Users36350admin.dbt\profiles.yml
Using dbt_project.yml file at C:\Users\36350admin\prefect\Users36350adminarrow_dbt-1\dbt_project.yml
Updated code:
Copy code
from prefect import flow
from prefect_dbt.cli.commands import trigger_dbt_cli_command

@flow(name="dbt")
def run_dbt() -> str:
    result = trigger_dbt_cli_command(command="dbt debug",
        project_dir="C:\\Users\\36350admin\\arrow_dbt-1",
        profiles_dir="C:\\Users\\36350admin\\.dbt"
        )
    return result

run_dbt()
a
Thanks for reporting this! I think the culprit might be: https://github.com/PrefectHQ/prefect-dbt/blob/main/prefect_dbt/cli/commands.py#L151