dbt
dbt helps data teams model and transform analytical data. Use the Altertable adapter to run dbt models directly in your Altertable lakehouse. You can also connect a dbt repository to make project definitions, lineage, and semantic metadata available to Altertable and its agents.
Installation
The Altertable adapter for dbt is available on PyPI and currently requires Python 3.10+ with dbt-core >=1.8,<2.0.
pip install dbt-altertable
If you manage Python dependencies with uv, you can install it with:
uv add dbt-altertable
Configuration
Add an Altertable profile to your profiles.yml file. By default, dbt looks for profiles in ~/.dbt/profiles.yml, but you can also place it in your project directory or specify a custom location using the --profiles-dir flag. Learn more about dbt profiles in the dbt documentation.
Profile Example
your_project_name:target: devoutputs:dev:type: altertableusername: YOUR_LAKEHOUSE_USERNAMEpassword: YOUR_LAKEHOUSE_PASSWORDdatabase: your_catalog_nameschema: your_schema_name
Configuration Parameters
- type: Must be set to
altertable(required) - username: Your lakehouse username (required) — find this in the Credentials section of the dashboard
- password: Your lakehouse password (required) — find this in the Credentials section of the dashboard
- database: The name of your Altertable catalog where models will be materialized (required)
- schema: The schema within your catalog where models will be created (required)
Usage
Once configured, you can run dbt commands against Altertable:
# Test your connectiondbt debug# Run your modelsdbt run# Test your modelsdbt test# Generate and serve documentationdbt docs generatedbt docs serve
Learn more about dbt commands in the dbt documentation.
Sync project knowledge
Connect your dbt project as a knowledge repository. Altertable detects dbt_project.yml at the repository root or in a subdirectory and turns project source files into searchable knowledge entries. A repository can contain multiple dbt projects.
In Knowledge, select New knowledge, choose Repository, and connect your GitHub or GitLab account. Choose the repository and branch, then select Add repository. Leave the branch empty to use the repository's default branch.
Which files need to be committed?
For Git-based sync, commit your dbt project source files to the connected branch. Include the artifacts below for lineage, model enrichment, and generated metric definitions. Contact us if you need to sync artifacts from a bucket.
| File | Purpose |
|---|---|
dbt_project.yml and project source files | Detect the project and extract knowledge from SQL, YAML, and documentation. |
target/manifest.json | Add model lineage and enrich existing semantic models with dbt metadata. |
target/semantic_manifest.json | Make generated metric and semantic definitions available as knowledge. |
Repository sync does not run dbt to generate artifacts. Without a valid manifest.json, Altertable still extracts knowledge from the source files, but skips manifest-based lineage and semantic model enrichment.
Generate and refresh the artifacts
From the directory containing dbt_project.yml, install project dependencies and parse the project. Use the target whose catalog and schema names match the data you want to describe in Altertable. Replace prod with that target's name in your dbt profile:
dbt depsdbt parse --target prodgit add -f target/manifest.json target/semantic_manifest.jsongit commit -m "docs(dbt): refresh project artifacts"git push
Commit both artifacts under target/ relative to dbt_project.yml.
After pushing, select Sync now from the repository menu. Regenerate and commit the artifacts when your dbt project changes.
Enrich existing semantic models
With a valid manifest.json, Altertable can update existing semantic models with dbt descriptions, column metadata, supported measures and dimensions, and relationships derived from entities. It matches each dbt model to an existing Altertable model by catalog, schema, and table name, using the dbt alias when configured. This enrichment does not materialize tables or create missing semantic models.
Metric definitions remain available as knowledge even when this enrichment cannot import them as native measures. For example, filtered simple metrics are not imported as unfiltered Altertable measures.
SQL Dialect
Altertable uses DuckDB as its query engine, so all SQL queries in your dbt models must use DuckDB-flavored SQL. This includes using DuckDB's functions, syntax, and data types.
Learn more about DuckDB SQL in the DuckDB documentation.
MetricFlow
The adapter can run dbt Semantic Layer and MetricFlow workloads by rendering MetricFlow SQL with DuckDB-compatible syntax. Keep your semantic models in dbt as usual, then run MetricFlow against the same Altertable profile.
This works best when your metrics use DuckDB-compatible functions and data types. If a metric relies on warehouse-specific SQL, adapt the expression to DuckDB SQL before running it on Altertable.
Seeds
By default, dbt seed inserts rows in batches so seeds work reliably across local files and remote execution. When you want a direct DuckDB COPY path for a local seed file, set the seed config fast: true.
seeds:your_project_name:+fast: true
Use the default batched path unless you know the seed file is accessible from the process running dbt.
Incremental models
The adapter supports dbt's delete+insert incremental strategy. Configure a stable unique_key so each run deletes matching destination rows before inserting the updated batch:
{{ config(materialized='incremental',incremental_strategy='delete+insert',unique_key='id') }}SELECT *FROM {{ source('app', 'orders') }}{% if is_incremental() %}WHERE updated_at > (SELECT max(updated_at) FROM {{ this }}){% endif %}
Each dbt connection uses an isolated Flight session, so concurrent model work does not share temporary session state.
Persisting descriptions
The adapter supports dbt's persist_docs setting for model and column descriptions.
Enable it in dbt_project.yml or on a model:
models:your_project_name:+persist_docs:relation: truecolumns: true
After dbt run, dbt writes model and column descriptions to Altertable with DuckDB COMMENT ON TABLE and COMMENT ON COLUMN statements. View column comments are skipped gracefully when DuckDB cannot apply them.
Source Code
The adapter source code is available at github.com/altertable-ai/dbt-altertable