I'm trying to get either prefect-dbt or prefect_db...
# prefect-dbt
a
I'm trying to get either prefect-dbt or prefect_dbt_flow to work and facing different issues. For prefect-dbt, I'm getting:
dbt task failed with exception: No such command 'run --no-write-json --select test'.
And the logs show:
Running dbt command: ['run --no-write-json --select test', '--profiles-dir', '/root/.dbt', '--project-dir', PosixPath('models')]
which is odd. It appears to somehow be stripping out the 'dbt' of the command despite my code having:
Copy code
def _dbt_run_and_test(model: str, upstream: list = None) -> str:
    dbt_profile = dbt_cli_profile
    cmd_run = f"dbt run --no-write-json --select {model}"
    cmd_test = f"dbt test --no-write-json --select {model}"
I've traced everything through
trigger_dbt_cli_command
but still can't find out how a word is being dropped. Second, with prefect_dbt_flow, I can't figure out how to pass a DbtCliProfile instead of a DbtProfile when creating a dbt_flow. I'm guessing the package just can't take in the cli object and is only written for the yaml. Is there a way to convert the cli profile to a yaml?
s
dbt
is being stripped out because of the way
prefect-dbt
uses programmatic invocation
I wonder if the issue with parsing
--no-write-json
. If you remove that, does it work for you? Also, what version of prefect-dbt are you using?
a
Ah
I tried it without that but same error just with the modified command
0.5.0
s
I think this might have solved it if you upgrade to 0.5.2
a
I'll give that a shot!
That fixed the first problem, thanks!
🎉 1