dbt-common
dbt-common is a Python library that provides shared common utilities used by dbt-core and various dbt adapter implementations. It centralizes functionalities to ensure consistency and efficiency across the dbt ecosystem. The library is actively maintained by dbt Labs, with a current version of 1.37.3, and typically follows the release cadence of `dbt-core` and related adapter packages.
Warnings
- breaking Major versions of `dbt-core` (e.g., v1 to v2) may include breaking changes that impact `dbt-common` and its consumers, particularly adapter plugins and custom implementations that rely on dbt's internal Python interfaces. These changes are typically communicated in dbt's release notes for adapter maintainers.
- breaking Changes to dbt's metadata interfaces, including artifacts (like `manifest.json`, `catalog.json`) and structured logging, are considered breaking for `dbt-common`'s consumers if fields are deleted, renamed, or their types/defaults change without backward compatibility.
- deprecated The `DBT_` environment variable prefix has been deprecated for custom variables to prevent collisions with dbt's internal variables. New dbt environment variables are now prefixed with `DBT_ENGINE`.
- gotcha `dbt-common` is a foundational library, not typically intended for direct end-user application development. Its utilities are primarily consumed by `dbt-core` and dbt adapter implementations. Expect minimal direct documentation for independent usage.
Install
-
pip install dbt-common
Imports
- __version__
import dbt_common; print(dbt_common.__version__)
- DbtCommonError
from dbt_common.exceptions import DbtCommonError
Quickstart
import dbt_common
from dbt_common.exceptions import DbtCommonError
print(f"dbt-common version: {dbt_common.__version__}")
try:
raise DbtCommonError("This is a dbt common error.")
except DbtCommonError as e:
print(f"Caught expected error: {e}")