| Adapter | Status | Install |
|---|---|---|
| DuckDB | Supported | included by default |
| MotherDuck | Supported | included by default (uses DuckDB) |
| Snowflake | Supported | sqlbuild[snowflake] |
| BigQuery | Supported | sqlbuild[bigquery] |
| Databricks | Supported | sqlbuild[databricks] |
| PostgreSQL | Supported | sqlbuild[postgres] |
| SQL Server | Supported | sqlbuild[sqlserver] |
| ClickHouse | Coming soon | |
| Redshift | Coming soon | |
| Trino | Coming soon | |
| Spark | Coming soon | |
| Athena | Coming soon |
sqlbuild_project.toml:
sqlbuild_local.toml:
Custom adapters
You can write your own adapter for any database engine by placing Python files underadapters/ in your project directory.
Extending a built-in adapter
The most common case is extending an existing adapter with custom behavior. Subclass the built-in adapter, set a newadapter_name, and override what you need:
Writing an adapter from scratch
For a database engine with no built-in support, subclassBaseAdapter. It provides ANSI SQL defaults for most methods - you only need to implement connect, execute, close, and any methods where your engine differs from standard SQL:
sql_analysis_dialect_name to the SQL dialect name that matches your engine’s SQL syntax. This enables compile-time SQL validation, column inference, column lineage, and local scenario replay for your adapter. If omitted, SQLBuild uses generic SQL parsing. SQL analysis is powered by Polyglot, a Rust reimplementation of SQLGlot supporting 32+ dialects.
For full control with no inherited defaults, subclass StrictAdapter instead. Every method is abstract and must be implemented explicitly. SQLBuild raises a clear error listing any unimplemented methods.
Discovery rules
- SQLBuild discovers all
.pyfiles underadapters/recursively (excluding__init__.pyand files starting with_) - Each file is scanned for classes that define a string
adapter_nameand subclassStrictAdapter(or any of its subclasses likeBaseAdapteror a built-in adapter) - Adapter names must be unique across all adapter files - duplicates raise an error
- Custom adapter names cannot shadow built-in names (
duckdb,snowflake,bigquery,databricks,postgres,sqlserver)
Adapter class hierarchy
StrictAdapter composes four mixins that define the full adapter contract:
- ConnectionMixin -
connect,close,begin,commit,rollback - SchemaMixin -
relation_exists,list_relations,describe_relation,ensure_schema - MaterializationMixin -
create_table_as,create_view,drop,rename,swap,load_seed - DiffMixin -
diff_schema,diff_rows,sample_unequal_rows,sample_side_only_rows

