https://prefect.io logo
Title
j

Jehan Abduljabbar

07/27/2022, 5:02 PM
Hello, I am having the following error with DbtShellTask(): "prefect.DbtShellTask | Command failed with exit code 127" I am following the flow example in here: https://docs.prefect.io/api/latest/tasks/dbt.html#dbtshelltask (with providing my own arguments). I can't tell what is source of the issue
1
k

Khuyen Tran

07/27/2022, 5:12 PM
Hi Jehan, could you provide a minimal example of your code?
j

Jehan Abduljabbar

07/27/2022, 5:17 PM
from prefect import Flow from prefect.tasks.dbt import DbtShellTask with Flow(name="dbt_flow") as f: task = DbtShellTask( profile_name="profile name", environment='dev', dbt_kwargs={ "type": "snowflake", "account": "account name", "user": "username", "authentictor": "externalbrowser", # tried password as well on other acct, same error "role": "role name", "warehouse": "wh name", "database": "db name" "schema": "schema name", "threads": 4, "client_session_keep_alive": True, }, overwrite_profiles=True, profiles_dir= r"C:\Users\jabduljabbar\.dbt" )(command='dbt run') out = f.run()
a

Andrew Huang

07/27/2022, 6:31 PM
do you have dbt installed?
e.g.
which dbt
:thank-you: 1
a

Anna Geller

07/27/2022, 7:00 PM
@Jehan Abduljabbar The 127 error code indicates “command not found”. This occurs when any given command within your Bash script or on Bash command line is not found in any of the paths defined by PATH system environment variable. The solution is to make sure that the command your are using can be found within your $PATH. If the command is not in your path either include it or use absolute full path to it. TL;DR: you didn't install dbt properly and you can't run any dbt commands in your execution environment
j

Jehan Abduljabbar

07/27/2022, 8:54 PM
I have dbt-core and dbt-snowflake installed by pip. dbt run command works when running it from terminal, in the same execution environment as where I am running the flow. But it doesn't work when using the DbtShellTask
a

Anna Geller

07/28/2022, 12:32 AM
are you running this on Windows? somehow the shell task cannot find dbt in your path
j

Jehan Abduljabbar

07/28/2022, 12:12 PM
yes on windows