dbt-adapters

raw JSON →
1.22.9 verified Tue May 12 auth: no python install: verified quickstart: stale

dbt-adapters is a Python library that defines the set of adapter protocols and base functionality crucial for integrating dbt-core with various data platforms. It serves as the foundational interface for developing database-specific dbt adapters. As of its current version 1.22.9, it's an actively developed component within the dbt ecosystem, with a release cadence that is increasingly independent of dbt-core, especially since dbt-core v1.8.

pip install dbt-adapters
error ModuleNotFoundError: No module named 'dbt.adapters.factory'
cause This error often occurs after upgrading dbt-core to version 1.8 or later without explicitly upgrading or reinstalling `dbt-adapters` or the specific database adapter, due to the decoupling of dbt-core and adapter packages.
fix
Reinstall or upgrade dbt-adapters and your specific dbt adapter (e.g., dbt-bigquery) alongside dbt-core. A common fix is pip install --force-reinstall dbt-adapters dbt-<your-adapter-name> or creating a fresh virtual environment and reinstalling everything.
error ModuleNotFoundError: No module named 'dbt.adapters.base.impl'
cause This typically indicates an incompatibility between the installed `dbt-adapters` version and other dbt packages (like `dbt-core` or specific database adapters) after an upgrade or during dependency resolution.
fix
Ensure all dbt-related packages (dbt-core, dbt-adapters, and your specific adapter) are compatible and updated together. Downgrading or forcing a reinstall of dbt-adapters to a compatible version often resolves the issue: pip install dbt-adapters==<compatible-version> or pip install --upgrade dbt-core dbt-adapters dbt-<your-adapter-name>.
error Could not find adapter type <adapter_name>!
cause This error occurs when dbt-core cannot locate the installed adapter plugin for the specified database type in your `profiles.yml` file, often due to a missing adapter installation or an incompatible version.
fix
Install the correct dbt adapter package for your database (e.g., pip install dbt-snowflake for Snowflake) and ensure it's compatible with your dbt-core version. Verify that your profiles.yml correctly specifies the adapter type.
error Command '['tar', '-zcf', '/tmp/dbt-workspace.tar.gz', 'xxx']' returned non-zero exit status 2.
cause This error often indicates that dbt commands are not being issued from the correct directory containing the `yarn.env` file, especially in environments like Cloudera Data Engineering (CDE).
fix
Ensure you are running the dbt command from the directory immediately outside your dbt project (e.g., ~/my-project-dir/ if your project is ~/my-project-dir/sample-dbt-project). Also, check the DBT_PROJECT_NAME variable in your yarn.env file.
breaking Breaking changes in dbt-core v1.8+ for adapter developers. dbt-core and dbt-adapters were decoupled. Adapters should no longer directly import from `dbt-core` and instead rely on interfaces defined in `dbt-adapters` and `dbt-common`. Users must explicitly install `dbt-core` and their specific `dbt-<adapter>` package.
fix Adapter maintainers: Refactor imports to use `dbt-adapters` and `dbt-common` interfaces. Users: Always explicitly install `dbt-core` and your desired `dbt-<adapter>` (e.g., `pip install dbt-core dbt-snowflake`).
gotcha Adapter methods like `get_response` and `execute` are expected to return `connection.AdapterResponse` objects, not just strings, since `dbt-core` v1.1. Custom adapters that return strings might face unexpected behavior.
fix Adapter maintainers should update method implementations to return `dbt.contracts.connection.AdapterResponse` objects or a subclass thereof.
gotcha Correct configuration of `profiles.yml` is essential. Missing or incorrect entries, or failing to install the corresponding `dbt-<database-adapter>` package, will prevent dbt from connecting to your data warehouse and result in errors like 'Error importing adapter: No module named...'
fix Ensure `profiles.yml` is correctly configured with `type` matching your installed adapter (e.g., `type: postgres` for `dbt-postgres`). Verify the specific `dbt-<database-adapter>` package is installed.
deprecated Starting with `dbt-core` v1.10, deprecation warnings are raised for custom inputs, duplicate YAML keys, and unexpected Jinja blocks. While initially warnings, these will become errors in future versions.
fix Review and update dbt project configurations and custom macros to eliminate deprecated patterns. Consult dbt-core release notes for specific guidance on addressing warnings.
breaking Changes to dbt artifact schema versions (e.g., manifest.json) require compatible `dbt-core` versions when using state-based functionality (`--state` flag). Mismatched schema versions will cause errors and require concurrent upgrades of dbt orchestrations.
fix When upgrading, ensure all dbt environments and state-dependent jobs are updated to compatible `dbt-core` versions simultaneously.
pip install dbt-core dbt-<your-database-adapter>
python os / libc variant status wheel install import disk
3.10 alpine (musl) dbt-adapters wheel - 2.04s 74.6M
3.10 alpine (musl) dbt-core build_error - - - -
3.10 alpine (musl) dbt-adapters - - 1.94s 74.1M
3.10 alpine (musl) dbt-core - - - -
3.10 slim (glibc) dbt-adapters wheel 6.0s 1.31s 75M
3.10 slim (glibc) dbt-core build_error - - - -
3.10 slim (glibc) dbt-adapters - - 1.33s 75M
3.10 slim (glibc) dbt-core - - - -
3.11 alpine (musl) dbt-adapters wheel - 2.62s 79.2M
3.11 alpine (musl) dbt-core build_error - - - -
3.11 alpine (musl) dbt-adapters - - 2.72s 78.7M
3.11 alpine (musl) dbt-core - - - -
3.11 slim (glibc) dbt-adapters wheel 5.9s 1.87s 80M
3.11 slim (glibc) dbt-core build_error - - - -
3.11 slim (glibc) dbt-adapters - - 1.68s 80M
3.11 slim (glibc) dbt-core - - - -
3.12 alpine (musl) dbt-adapters wheel - 2.18s 70.4M
3.12 alpine (musl) dbt-core build_error - - - -
3.12 alpine (musl) dbt-adapters - - 2.44s 70.0M
3.12 alpine (musl) dbt-core - - - -
3.12 slim (glibc) dbt-adapters wheel 4.9s 1.92s 71M
3.12 slim (glibc) dbt-core build_error - - - -
3.12 slim (glibc) dbt-adapters - - 1.93s 71M
3.12 slim (glibc) dbt-core - - - -
3.13 alpine (musl) dbt-adapters wheel - 2.02s 70.2M
3.13 alpine (musl) dbt-core build_error - - - -
3.13 alpine (musl) dbt-adapters - - 2.21s 69.6M
3.13 alpine (musl) dbt-core - - - -
3.13 slim (glibc) dbt-adapters wheel 5.1s 1.70s 71M
3.13 slim (glibc) dbt-core build_error - - - -
3.13 slim (glibc) dbt-adapters - - 1.87s 70M
3.13 slim (glibc) dbt-core - - - -
3.9 alpine (musl) dbt-adapters wheel - 2.01s 73.6M
3.9 alpine (musl) dbt-core build_error - - - -
3.9 alpine (musl) dbt-adapters - - 1.95s 73.5M
3.9 alpine (musl) dbt-core - - - -
3.9 slim (glibc) dbt-adapters wheel 6.7s 1.72s 74M
3.9 slim (glibc) dbt-core build_error - - - -
3.9 slim (glibc) dbt-adapters - - 1.56s 74M
3.9 slim (glibc) dbt-core - - - -

dbt-adapters is a low-level library for building dbt adapters. End-users interact with adapter functionality through dbt-core and specific database adapters. The quickstart below illustrates how a dbt user sets up a project and uses adapter-specific logic via Jinja macros in a SQL model, which leverages the interfaces provided by `dbt-adapters`.

# 1. Install dbt-core and your specific database adapter (e.g., dbt-postgres)
# pip install dbt-core dbt-postgres

# 2. Initialize a dbt project
# dbt init my_dbt_project
# cd my_dbt_project

# 3. Configure your profiles.yml (typically in ~/.dbt/profiles.yml)
# Example profiles.yml content (replace with your database details):
# my_dbt_project:
#   target: dev
#   outputs:
#     dev:
#       type: postgres
#       host: localhost
#       user: myuser
#       password: "{{ env_var('DB_PASSWORD') }}"
#       port: 5432
#       dbname: mydatabase
#       schema: public

# 4. Create a dbt model (e.g., models/my_model.sql)
# Use the 'adapter' object in Jinja to call adapter-specific functionality.
# For instance, to get the current timestamp, which might vary by database dialect:
-- my_model.sql
SELECT
    {{ adapter.dispatch('current_timestamp', 'dbt')() }} as current_time,
    1 as id