Jack Goslin
08/22/2024, 8:14 PMrun_dbt_test()
?Marvin
08/22/2024, 8:15 PMrun_dbt_test()
by passing the name
parameter. Below is an example code snippet:
python
from prefect import flow
from prefect_dbt.cli.tasks import run_dbt_test
@flow
def dbt_flow():
run_dbt_test(
project_dir="/path/to/project",
name="Custom DBT Test Task Name"
)
if __name__ == "__main__":
dbt_flow()
The parameter name
allows you to set a custom name for the Prefect task.
For more details, you can check out the Prefect documentation here.
If you need further assistance, you might find it useful to check the related GitHub pull request here.Jack Goslin
08/22/2024, 8:16 PMMarvin
08/22/2024, 8:17 PMrun_dbt_test()
. However, you can wrap the task in your own Prefect task and set the name manually. Here's an example:
python
from prefect import flow, task
from prefect_dbt.cli.tasks import run_dbt_test
@task(name="Custom DBT Test Task Name")
def custom_run_dbt_test(project_dir, profiles_dir=None, overwrite_profiles=False, dbt_cli_profile=None, create_artifact=True, artifact_key="dbt-test-task-summary"):
run_dbt_test(
project_dir=project_dir,
profiles_dir=profiles_dir,
overwrite_profiles=overwrite_profiles,
dbt_cli_profile=dbt_cli_profile,
create_artifact=create_artifact,
artifact_key=artifact_key
)
@flow
def dbt_flow():
custom_run_dbt_test(project_dir="/path/to/project")
if __name__ == "__main__":
dbt_flow()
By defining your own task, you can specify a custom name and call run_dbt_test()
within it.
For further reference, you can look at the relevant Prefect documentation:
- Prefect Tasks: https://docs.prefect.io/latest/concepts/tasks/
- Prefect Dbt CLI Commands: https://docs.prefect.io/latest/integrations/prefect-dbt/cli/commands/
If you have any more questions, feel free to ask!Jack Goslin
08/22/2024, 8:18 PM