Skip to main content
The Kinetica adapter for dbt (dbt-kinetica) lets dbt build, test, snapshot, and document data models in Kinetica. The adapter connects through the Python API, so no ODBC or JDBC driver is needed. The adapter is open source, and is developed and maintained by Rosetta Labs.
The adapter is in alpha, and has been verified against Kinetica 7.2.3. It has not been tested against earlier versions of Kinetica.

Installation

The adapter requires Python 3.10 or later and dbt Core 1.x. It can be installed from PyPI using pip, which also installs dbt Core and the Kinetica Python API:
To verify the installation, run dbt --version; kinetica is listed under Plugins. The adapter’s source is available on GitHub:

Connecting

dbt connects to Kinetica using a profile of type kinetica in the dbt profiles.yml file. Running dbt init in a new project prompts for the required settings.
profiles.yml
To check the connection, run dbt debug.

Profile Settings

Model Configuration

In addition to dbt’s standard model settings, the adapter supports the following settings, which can be given in a model’s config() block or in dbt_project.yml. For example, this incremental model replaces any existing records that have the same order_id as new ones, and expires its table after a day without use:
Incremental Model

How dbt Runs on Kinetica

  • Transactions - Each statement takes effect as soon as it runs; dbt’s transaction statements are not sent, and hooks run as ordinary statements.
  • Tables and views - Each run replaces a model’s table or view in place, using CREATE OR REPLACE. A materialized view is replaced when dbt is run with --full-refresh, and is otherwise refreshed.
  • Incremental models - New records are staged in a temporary table, <model>__dbt_tmp, which is dropped at the end of the run. With delete+insert, records in the model whose unique_key matches a staged record are deleted, and then the staged records are inserted.
  • Snapshots - Snapshots use NOW() as the snapshot time and SHA256() to generate the dbt_scd_id column.
  • Seeds - Seed files are loaded in batches of 5,000 records.
  • Metadata - Schema, table, and column information is read through the /show/schema and /show/table endpoints.

Limitations

  • The merge and insert_overwrite incremental strategies are not supported; use delete+insert or append instead.
  • persist_docs is not supported; model and column descriptions are not saved to the database.
  • Views and materialized views cannot be renamed.
  • Source freshness cannot be checked from table metadata; sources with a loaded_at_field can be checked.
  • Python models are not supported.

Example Project

The adapter’s GitHub repository includes a small example project in examples/demo, with seeds, staging views, a table with a time-to-live, a delete+insert incremental model, tests, and a snapshot. To run it, set the KINETICA_HOST, KINETICA_USER, and KINETICA_PASSWORD environment variables, and then run the following from the examples/demo directory: