https://prefect.io logo
#prefect-community
Title
# prefect-community
j

Jonathan Mathews

05/12/2022, 9:17 AM
Hi all! Sometimes I’m a bit confused how to set task args when using built-in dbt tasks (such as dbt), Is this the correct syntax for setting a tag on the task? (reason I ask is i can’t see it in prefect cloud when I click into the task):
Copy code
dbt_run = dbt(
        command=dbt_run_command,
        task_args={"name": "dbt run", "tags": ["dbt-limit-1"]},
        upstream_tasks=[dbt_deps],
        dbt_kwargs=snowflake_credentials
    )
a

Anna Geller

05/12/2022, 10:12 AM
your syntax looks correct and the tags you mentioned are for task concurrency and should be visible here after registering your flow https://cloud.prefect.io/team/task-concurrency did you register?
could you perhaps also show your full flow definition, perhaps the dbt task is missing some configuration?
j

Jonathan Mathews

05/12/2022, 10:52 AM
Ah great, thanks. I think the problem is that my task runs so quickly that when I look at that screen I never see it. Here’s my task definition:
Copy code
dbt = DbtShellTask(
    return_all=True,
    profile_name="snowflake_dbt",
    environment="prod",
    overwrite_profiles=True,
    set_profiles_envar=True,
    profiles_dir=f"{cwd}/repo/DBT",
    log_stdout=True,
    helper_script=f"cd repo/DBT",
    log_stderr=True,
    dbt_kwargs={
        "type": "snowflake",
        "account": SNOWFLAKE_ACCOUNT,
        "database": SNOWFLAKE_DATABASE,
        "warehouse": SNOWFLAKE_WAREHOUSE,
        "schema": SNOWFLAKE_SCHEMA,
        "user": SNOWFLAKE_USER,
        "role": SNOWFLAKE_ROLE,
        "threads": 12,
        "client_session_keep_alive": False
    },
)
a

Anna Geller

05/12/2022, 11:39 AM
this dbt configuration is perfect, this shouldn't be an issue perhaps it's indeed some UI latency then - are you good now? LMK if I can help
j

Jonathan Mathews

05/13/2022, 10:16 AM
Thanks Anna! I was able to verify that it’s working now
👍 1
8 Views