A dbt adapter is built from four main functional components. While the first two are platform-specific and require heavy implementation in a concrete adapter, the latter two are largely provided by dbt-adapters itself.
1. Connections
Responsible for creating and managing connections to the underlying storage and compute resources.
- Implementation location:
dbt/adapters/{base|sql}/connections.py
2. Dialect
Responsible for translating requests from dbt-core into the specific syntax and actions required by the target platform.
- Implementation location: Includes
dbt/adapters/base/column.py, dbt/adapters/base/relation.py, dbt/adapters/clients/jinja.py, and various relation configurations.
3. Relation Caching
Manages a local cache of relations, relation metadata, and the dependencies between those relations to optimize performance.
- Implementation location:
dbt/adapters/cache.py
4. Integration with dbt-core
Manages the formal interface and communication protocols between dbt-core and the concrete adapter implementation.
- Implementation location: Includes
dbt/adapters/{base|sql}/impl.py, dbt/adapters/factory.py, dbt/adapters/protocol.py, and various contract/event/exception modules.