Skip to main content

prefect_dbt.core.runner

Runner for dbt commands

Functions

execute_dbt_node

Execute a dbt node and wait for its completion. This function will:
  1. Set up the task logger
  2. Wait for the node to finish using efficient threading.Event
  3. Check the node’s status and fail if it’s in a failure state

Classes

PrefectDbtRunner

A runner for executing dbt commands with Prefect integration. This class enables the invocation of dbt commands while integrating with Prefect’s logging and assets capabilities. Args:
  • manifest: Optional pre-loaded dbt manifest
  • settings: Optional PrefectDbtSettings instance for configuring dbt
  • raise_on_failure: Whether to raise an error if the dbt command encounters a non-exception failure
  • client: Optional Prefect client instance
  • include_compiled_code: Whether to include compiled code in the asset description
  • disable_assets: Global override for disabling asset generation for dbt nodes. If True, assets will not be created for any dbt nodes, even if the node’s prefect config has enable_assets set to True.
  • _force_nodes_as_tasks: Whether to force each dbt node execution to have a Prefect task representation when .invoke() is called outside of a flow or task run
Methods:

get_dbt_event_msg

graph

invoke

Invokes a dbt command. Supports the same arguments as dbtRunner.invoke(). https://docs.getdbt.com/reference/programmatic-invocations Args:
  • args: List of command line arguments
  • **kwargs: Additional keyword arguments
Returns:
  • The result of the dbt command invocation

log_level

manifest

on_run_end

on_run_start

post_model

profiles_dir

project_dir

project_name

target_path