Skip to main content

DBT adapter for Altertable

Project description

dbt-altertable

CI PyPI version Python versions License: MIT

A dbt adapter for Altertable, backed by Arrow Flight SQL.

Requirements

  • Python 3.10+
  • dbt-core >=1.8,<2.0

Installation

pip install dbt-altertable

Or with uv:

uv add dbt-altertable

Configuration

Add a profile to ~/.dbt/profiles.yml:

my_project:
  target: dev
  outputs:
    dev:
      type: altertable
      username: your_username
      password: your_password
      database: your_database
      schema: your_schema
      host: flight.altertable.ai  # optional, this is the default
      port: 443                    # optional, this is the default
      tls: true                    # optional, this is the default
Field Required Default Description
username yes Altertable username
password yes Altertable password
database yes Target catalog name
schema yes Target schema name
host no flight.altertable.ai Flight SQL endpoint host
port no 443 Flight SQL endpoint port
tls no true Use TLS for the Flight SQL connection

SQL dialect

dbt models should use DuckDB-compatible SQL. Altertable executes queries via DuckDB, so all DuckDB SQL features and functions are available — see the DuckDB SQL reference.

Persisting model and column descriptions

When you enable [persist_docs](https://docs.getdbt.com/referen ce/resource-configs/persist_docs), dbt writes model and column description values to the warehouse using DuckDB’s COMMENT ON TABLE / COMMENT ON COLUMN syntax (one statement per column so Arrow Flight SQL accepts each round-trip).

Enable it in dbt_project.yml or on a model:

models:
  my_project:
    +persist_docs:
      relation: true
      columns: true

After a successful dbt run, descriptions show up on duckdb_tables() / duckdb_columns() (and therefore in dbt docs generate / catalog metadata).

Development

This project is managed with uv and hatchling.

git clone https://github.com/altertable-ai/dbt-altertable.git
cd dbt-altertable
uv sync --extra dev

Common tasks (see Makefile):

make lint        # ruff format + ruff check --fix
make typecheck   # ty check
make test        # pytest
make build       # uv build (wheel + sdist)

Integration tests

Flight SQL integration tests (for example persist_docs) run against altertable-mock in CI: the workflow builds the mock from main, starts it with --user dbt_ci:dbt_ci_secret, then runs pytest tests/integration. The default matrix job runs unit tests only (pytest --ignore=tests/integration).

Locally — Testcontainers (requires Docker; installs testcontainers via the integration extra):

ALTERTABLE_USE_TESTCONTAINERS=1 make test

make test detects that flag, runs uv sync --extra dev --extra integration, sets TESTCONTAINERS_RYUK_DISABLED=true by default (Ryuk often hangs on Docker Desktop), then runs the full pytest suite.

Or run only integration tests:

uv sync --extra dev --extra integration
export TESTCONTAINERS_RYUK_DISABLED=${TESTCONTAINERS_RYUK_DISABLED:-true}
ALTERTABLE_USE_TESTCONTAINERS=1 uv run pytest tests/integration -v

Optional overrides: ALTERTABLE_MOCK_IMAGE (default ghcr.io/altertable-ai/altertable-mock:latest), ALTERTABLE_MOCK_BOOT_USER (default dbt_ci:dbt_ci_secret, passed as --user to the mock), ALTERTABLE_MOCK_WAIT_TIMEOUT (seconds to wait for Starting Flight SQL server in logs, default 180).

If dbt run fails against the published image (for example catalog or information_schema errors), build the mock from source and point tests at it: docker build -t altertable-mock:local . then export ALTERTABLE_MOCK_IMAGE=altertable-mock:local — CI builds from main for the same reason.

Real Altertable — set the same ALTERTABLE_TEST_* variables to your Flight endpoint, catalog, and schema; do not set ALTERTABLE_USE_TESTCONTAINERS.

Optional pre-commit hooks:

uv run pre-commit install --hook-type pre-commit --hook-type commit-msg

Releases

Releases are managed via release-please — every push to main updates a rolling release PR. Merging it bumps the version, updates CHANGELOG.md, tags the release, and triggers PyPI publishing via trusted publishing.

Credits

This adapter draws on the design of dbt-duckdb.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_altertable-0.2.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_altertable-0.2.2-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file dbt_altertable-0.2.2.tar.gz.

File metadata

  • Download URL: dbt_altertable-0.2.2.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbt_altertable-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0e558921c9f24eb1f21ee0d0de8d1491590f6ff7abb61aff1ee4ae20c9d5fd3f
MD5 6d938a9093af83755b5267d9b7cb879e
BLAKE2b-256 13ccd15904f4763ae611e3479bce95d6827cf10bff1886881bca653702ec33a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbt_altertable-0.2.2.tar.gz:

Publisher: publish.yml on altertable-ai/dbt-altertable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbt_altertable-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: dbt_altertable-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbt_altertable-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 05d5fd0aa7950075e5e20a59c78ab6ab9f913599e72fbff70f0ded561ed91e66
MD5 5e16c7e2bce0ac00b6ba9a37c00113d8
BLAKE2b-256 d60b6f2995260e3d326b54e567267ab84de1cf316bb3c98e3192a3b1bf8e791b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbt_altertable-0.2.2-py3-none-any.whl:

Publisher: publish.yml on altertable-ai/dbt-altertable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page