{"library":"prefect-dbt","title":"Prefect dbt Integration","description":"Prefect-dbt is an official Prefect integration for orchestrating dbt (data build tool) projects within Prefect workflows. It provides tasks and blocks for interacting with the dbt CLI, allowing users to run dbt commands (like `dbt run`, `dbt test`, `dbt build`) as part of their data pipelines. The current version is 0.7.20, and it follows Prefect's release cadence for integrations, with updates typically coinciding with or following major Prefect releases.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install prefect-dbt"],"cli":null},"imports":["from prefect_dbt.cli import DbtCli","from prefect_dbt.cli import DbtCliProfile","from prefect_dbt.cli import dbt_cli_task"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom prefect import flow, get_run_logger\nfrom prefect_dbt.cli import DbtCli\n\n@flow(log_prints=True)\ndef dbt_cli_debug_flow():\n    \"\"\"\n    A simple Prefect flow that runs `dbt debug` using the prefect-dbt integration.\n    This demonstrates basic interaction with the dbt CLI via Prefect.\n    \"\"\"\n    logger = get_run_logger()\n    \n    # Initialize DbtCli. By default, it looks for dbt in the PATH\n    # and profiles.yml in the standard dbt locations or specified via env vars.\n    dbt_cli = DbtCli()\n    \n    logger.info(\"Attempting to run `dbt debug`...\")\n    \n    # Run the `debug` command. This checks dbt installation and profiles.\n    # It usually doesn't require a specific dbt project directory or database connection to run.\n    try:\n        debug_result = dbt_cli.debug()\n        \n        logger.info(f\"dbt debug completed with return code: {debug_result.return_code}\")\n        logger.info(f\"dbt debug stdout:\\n{debug_result.stdout}\")\n        \n        if debug_result.return_code != 0:\n            logger.error(f\"dbt debug stderr:\\n{debug_result.stderr}\")\n            raise RuntimeError(f\"`dbt debug` failed with return code {debug_result.return_code}\")\n            \n    except Exception as e:\n        logger.error(f\"Failed to execute dbt debug: {e}\")\n        logger.warning(\n            \"Ensure 'dbt-core' is installed in your execution environment \"\n            f\"(`pip install dbt-core` or specific adapter like `pip install dbt-postgres`).\"\n        )\n        raise\n\nif __name__ == \"__main__\":\n    dbt_cli_debug_flow() # For local execution\n    # To deploy: dbt_cli_debug_flow.to_deployment(name=\"dbt-debug-deployment\").apply()","lang":"python","description":"This quickstart demonstrates a simple Prefect flow that uses `prefect-dbt` to execute the `dbt debug` command. This is a good starting point as it verifies the dbt installation and profile configuration without requiring a full dbt project or database connection. For `dbt run`, `dbt test`, etc., you would typically set up a `DbtCliProfile` block in the Prefect UI and load it in your flow.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"0.7.8","pypi_latest":"0.7.24","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":25.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"320.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":27,"import_time_s":null,"mem_mb":null,"disk_size":"321M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"350.3M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":27.8,"import_time_s":null,"mem_mb":null,"disk_size":"351M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"337.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":22.2,"import_time_s":null,"mem_mb":null,"disk_size":"340M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"335.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":21.5,"import_time_s":null,"mem_mb":null,"disk_size":"337M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"251.2M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"prefect-dbt","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":29.3,"import_time_s":null,"mem_mb":null,"disk_size":"252M"}]}}