tessl install tessl/pypi-apache-airflow-providers-dbt-cloud@4.4.0Provider package for integrating Apache Airflow with dbt Cloud for data transformation workflow orchestration
Agent Success
Agent success rate when using this tile
84%
Improvement
Agent success rate improvement when using this tile compared to baseline
1x
Baseline
Agent success rate without this tile
84%
Build a Python utility that demonstrates proper handling of dbt Cloud's multi-version API architecture by routing requests to the correct API version.
dbt Cloud uses different API versions for different resource types. Projects and environments use the V3 API, while jobs and runs use the V2 API. This design ensures backward compatibility while enabling new features.
Create a Python module that routes API requests to the appropriate version based on resource type.
Your utility should provide functions to:
The dbt Cloud API uses version-specific base paths:
/api/v2/accounts/{account_id}/.../api/v3/accounts/{account_id}/...Base URL: https://{tenant}.getdbt.com
Authentication: Bearer token in Authorization header
@generates
class DbtCloudAPIRouter:
"""Routes dbt Cloud API requests to the appropriate API version."""
def __init__(self, account_id: int, api_token: str, tenant: str = "cloud"):
"""Initialize the router.
Args:
account_id: dbt Cloud account ID
api_token: API authentication token
tenant: dbt Cloud tenant (default: "cloud")
"""
pass
def get_project(self, project_id: int) -> dict:
"""Retrieve project details using V3 API.
Args:
project_id: The project ID
Returns:
Project data
"""
pass
def list_environments(self, project_id: int) -> list:
"""List environments in a project using V3 API.
Args:
project_id: The project ID
Returns:
List of environments
"""
pass
def get_job(self, job_id: int) -> dict:
"""Retrieve job details using V2 API.
Args:
job_id: The job ID
Returns:
Job data
"""
pass
def get_job_run(self, run_id: int) -> dict:
"""Retrieve job run details using V2 API.
Args:
run_id: The run ID
Returns:
Job run data including status
"""
passProvides integration with dbt Cloud API for orchestrating data transformation workflows.
HTTP library for making API requests.