Skip to content

Home

An unaffiliated python interface for dbt Cloud APIs

Coverage Package version Downloads


Documentation: https://dbtc.dpguthrie.com

Interactive Demo: https://dpguthrie-dbtc-streamlit-home-yy7c0b.streamlit.app/

Source Code: https://github.com/dpguthrie/dbtc

V2 Docs: https://docs.getdbt.com/dbt-cloud/api-v2

V3 Docs (Unofficial): https://documenter.getpostman.com/view/14183654/UVsSNiXC


Quick Intro

Overview

dbtc is an unaffiliated python interface to various dbt Cloud API endpoints.

This library acts as a convenient interface to two different APIs that dbt Cloud offers:

  • Cloud API: This is a REST API that exposes endpoints that allow users to programatically create, read, update, and delete resources within their dbt Cloud Account.
  • Metadata API: This is a GraphQL API that exposes metadata generated from a job run within dbt Cloud.

Requirements

Python 3.7+

  • Requests - The elegant and simple HTTP library for Python, built for human beings.
  • sgqlc - Simple GraphQL Client
  • Typer - Library for building CLI applications

Installation

pip install dbtc Successfully installed dbtc restart ↻

Basic Usage

Python

The interface to both APIs are located in the dbtCloudClient class.

The example below shows how you use the cloud property on an instance of the dbtCloudClient class to access methods that allow for programmatic control over dbt Cloud resources.

from dbtc import dbtCloudClient

client = dbtCloudClient()

project = client.cloud.get_project(account_id=1, project_id=1)

CLI

All of the methods available via the dbtCloudClient class are also available through the command line via dbtc.

The same code above can be written as follows using the CLI:

dbtc get-project --account-id=1 --project-id=1

License

This project is licensed under the terms of the MIT license.