Skip to content

Commit

Permalink
prefect-dbt - Clarify missing profile error (#14868)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Streed <[email protected]>
  • Loading branch information
seanpwlms and desertaxle authored Aug 9, 2024
1 parent fa0df1e commit 5da6902
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/integrations/prefect-dbt/prefect_dbt/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def trigger_dbt_cli_command_flow():
# write the profile if overwrite or no profiles exist
if overwrite_profiles or not Path(profiles_path).expanduser().exists():
if dbt_cli_profile is None:
raise ValueError("Provide `dbt_cli_profile` keyword for writing profiles")
raise ValueError(
"Profile not found. Provide `dbt_cli_profile` or"
f" ensure profiles.yml exists at {profiles_path}."
)
profile = dbt_cli_profile.get_profile()
Path(profiles_dir).expanduser().mkdir(exist_ok=True)
with open(profiles_path, "w+") as f:
Expand Down Expand Up @@ -204,11 +207,11 @@ def _stream_output(event):
)
else:
logger.debug(
f"Artifacts were not created for dbt {command} this task \
due to create_artifact=False or the dbt command did not \
return any RunExecutionResults. \
See https://docs.getdbt.com/reference/programmatic-invocations \
for more details on dbtRunnerResult."
f"Artifacts were not created for dbt {command} this task "
"due to create_artifact=False or the dbt command did not "
"return any RunExecutionResults. "
"See https://docs.getdbt.com/reference/programmatic-invocations "
"for more details on dbtRunnerResult."
)
if isinstance(result.result, RunExecutionResult) and not result.success:
return Failed(
Expand Down
2 changes: 1 addition & 1 deletion src/integrations/prefect-dbt/tests/cli/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_flow():
)

with pytest.raises(
ValueError, match="Provide `dbt_cli_profile` keyword for writing profiles"
ValueError, match="Profile not found. Provide `dbt_cli_profile` or"
):
test_flow()

Expand Down

0 comments on commit 5da6902

Please sign in to comment.