Skip to main content

The GizmoSQL adapter plugin for dbt

Project description

dbt-gizmosql

A dbt adapter for GizmoSQL

dbt-gizmosql-ci Supported Python Versions PyPI version PyPI Downloads

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.

dbt is the T in ELT. Organize, cleanse, denormalize, filter, rename, and pre-aggregate the raw data in your warehouse so that it's ready for analysis.

GizmoSQL

GizmoSQL is an Apache Arrow Flight-based SQL engine for data warehouses. It is designed to be fast, scalable, and easy to use.

It has DuckDB and SQLite back-ends. You can see more information about GizmoSQL here.

Features

This adapter provides feature parity with dbt-duckdb for all features applicable to a remote Flight SQL connection:

Materializations

  • Table and View (SQL and Python)
  • Incremental with four strategies:
    • append -- simple record additions
    • delete+insert -- key-based upserts with DuckDB's DELETE...USING syntax
    • merge -- uses DuckDB's MERGE with UPDATE BY NAME / INSERT BY NAME
    • microbatch -- time-based batch processing via event_time windows
  • Snapshot (check and timestamp modes) using UPDATE+INSERT pattern
  • Schema change handling: ignore, append_new_columns, sync_all_columns, fail

Python Models

Python models execute client-side using a local DuckDB instance for full API compatibility, then ship results to GizmoSQL via ADBC bulk ingest:

def model(dbt, session):
    dbt.config(materialized="table")
    df = dbt.ref("upstream_model")
    df = df.filter(df.amount > 100)
    return df
  • Supports DuckDB relations, pandas DataFrames, and PyArrow Tables as return types
  • dbt.ref() and dbt.source() fetch data from GizmoSQL as Arrow and expose it as DuckDB relations
  • Incremental Python models supported (with proper dbt.is_incremental handling)

Seed Loading

Seeds are loaded using DuckDB's CSV reader on the client side with ADBC bulk ingest to the server:

  • Correct null handling (empty CSV fields become SQL NULL, not the string 'null')
  • Proper type inference (dates detected as DATE, integers as BIGINT, etc.)
  • Supports column_types overrides and custom delimiters
  • Significantly faster than dbt's default batch INSERT path

Constraints

All constraint types are enforced: CHECK, NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY.

Documentation

  • persist_docs support (COMMENT ON for relations and columns)
  • Full catalog generation with dbt docs generate

Utility Macros

DuckDB-compatible overrides for: dateadd, last_day, listagg, split_part.

Installation

Option 1 - from PyPi

# Create the virtual environment
python3 -m venv .venv

# Activate the virtual environment
. .venv/bin/activate

pip install --upgrade pip

python -m pip install dbt-core dbt-gizmosql

Option 2 - from source (for development)

git clone https://github.com/gizmodata/dbt-gizmosql

cd dbt-gizmosql

# Create the virtual environment
python3 -m venv .venv

# Activate the virtual environment
. .venv/bin/activate

# Upgrade pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel

# Install the dbt GizmoSQL adapter - in editable mode with dev dependencies
pip install --editable .[dev]

Configuration

Profile setup

Add the following to your ~/.dbt/profiles.yml (change values to match your environment):

my-gizmosql-db:
  target: dev
  outputs:
    dev:
      type: gizmosql
      host: localhost
      port: 31337
      database: dbt
      user: [username]
      password: [password]
      use_encryption: True
      tls_skip_verify: True
      threads: 2

OAuth/SSO Authentication

For browser-based OAuth/SSO, use auth_type: external -- no username or password needed:

my-gizmosql-db:
  target: dev
  outputs:
    dev:
      type: gizmosql
      host: gizmosql.example.com
      port: 31337
      auth_type: external
      use_encryption: True
      threads: 2

Architecture

This adapter connects to GizmoSQL via Apache Arrow Flight SQL using the ADBC driver (adbc-driver-gizmosql). Key architectural decisions:

  • Autocommit mode: Each statement auto-commits immediately. Flight SQL's PREPARE phase validates against committed catalog state, so explicit transactions would cause DDL from earlier statements to be invisible to later ones.
  • Client-side DuckDB: Seeds and Python models use a local DuckDB instance for processing, with results shipped to the server via ADBC bulk ingest (Arrow columnar format over gRPC).
  • MERGE BY NAME: Incremental merges use DuckDB's UPDATE BY NAME / INSERT BY NAME syntax, which is resilient to column ordering differences.

Versioning

This adapter follows semantic versioning. The major.minor version tracks dbt-core (e.g., dbt-core 1.11.x -> dbt-gizmosql 1.11.x).

Reporting bugs and contributing code

  • Want to report a bug or request a feature? Open an issue
  • Want to contribute? Pull requests are welcome

Code of Conduct

Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the dbt Code of Conduct.

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_gizmosql-1.11.12.tar.gz (22.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_gizmosql-1.11.12-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file dbt_gizmosql-1.11.12.tar.gz.

File metadata

  • Download URL: dbt_gizmosql-1.11.12.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dbt_gizmosql-1.11.12.tar.gz
Algorithm Hash digest
SHA256 02eeb791e0642ff89ed24625f253a7fc1eb32281fecf840b5bbea56d96f4c615
MD5 c618fefc099e806039bf4a55a91ee7d5
BLAKE2b-256 a2beb39fc47c86a070c52b09739489bb60abb26bc003713c2d0e068604e34151

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbt_gizmosql-1.11.12.tar.gz:

Publisher: ci.yml on gizmodata/dbt-gizmosql

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_gizmosql-1.11.12-py3-none-any.whl.

File metadata

  • Download URL: dbt_gizmosql-1.11.12-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dbt_gizmosql-1.11.12-py3-none-any.whl
Algorithm Hash digest
SHA256 d1f893ccf60242ffda8c0b6fe9b885775febc99a99879e11b20be6bec14bcebf
MD5 84bec089b0eb15f691c9252ebce2db7b
BLAKE2b-256 0a6fe021f6a8facc0c63c45baea484b7cdd919cad6a0f5c1a00db9f25757872e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbt_gizmosql-1.11.12-py3-none-any.whl:

Publisher: ci.yml on gizmodata/dbt-gizmosql

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