dbt-protos
dbt-protos is a Python library that provides public Protocol Buffer (proto) bindings for dbt. It serves as a central, 100% generated repository for dbt's public proto definitions, facilitating internal communication and metadata handling within the dbt ecosystem. Currently at version 1.0.443, its release cadence is closely tied to dbt Core and other related dbt libraries.
Warnings
- breaking Incompatible Protobuf Gencode/Runtime Versions: Using `dbt-protos` with an older `protobuf` runtime than the version it was generated with can lead to `google.protobuf.runtime_version.VersionError`. This is a common issue with any protobuf-generated code.
- gotcha Library is 100% Generated: `dbt-protos` is entirely generated code. Direct modifications to its files are not recommended as they will be overwritten by future updates. This also means the API surface is dictated by the underlying .proto definitions.
- gotcha Primarily an Internal/Foundational Library: `dbt-protos` provides low-level bindings for dbt's internal communication and metadata. It is not typically used for direct end-user data transformation logic or application development in the same way `dbt-core` or adapter plugins are. Expectations of a rich, high-level API for general use may lead to confusion.
Install
-
pip install dbt-protos
Imports
- Project
from dbt_protos.dbt_common_pb2 import Project
Quickstart
from dbt_protos.dbt_common_pb2 import Project
# Instantiate a generated proto message (e.g., a 'Project' message)
project_message = Project(name="my_dbt_project", dbt_version="1.8.0")
print(f"Created dbt Project message: {project_message.name} (dbt version: {project_message.dbt_version})")