dbt Cloud

The dbt Cloud integration synchronizes your dbt metadata into the lineage graph.

Web App

dbt Cloud Integration

Fields

FieldValueExample
sourceThe name of the source, see sourcesmy-source
NameName for connectiondbt Cloud
NamespaceNamespace for the connection, see namespacedefault
api_keydbt Cloud api key, see api key

ApiKey

Follow https://docs.getdbt.com/docs/dbt-cloud-apis/user-tokens (opens in a new tab) to generate an api key.

Python Library

The dbt integration can be run as a standalone python library to extract data lineage from the dbt cloud api.

The library is available via pip

pip install grai_source_dbt_cloud

More information about the API is available here.

Example

The library is split into a few distinct functions but if you only wish to extract nodes/edges from dbt you can do so as follows:

  from grai_source_dbt_cloud import DbtCloudIntegration
  from grai_schemas.v1.source import SourceV1
 
  source = SourceV1(name="my-source", type="my-type")
 
  integration = DbtCloudIntegration(source=source, namespace="dbt", api_key="my-api-key")
 
  nodes, edges = integration.get_nodes_and_edges()