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 usingpip, which also installs dbt Core and the
Kinetica Python API:
dbt --version; kinetica is listed under
Plugins.
The adapter’s source is available on GitHub:
Connecting
dbt connects to Kinetica using a profile of typekinetica in the dbt
profiles.yml file. Running dbt init in a new project prompts for the
required settings.
profiles.yml
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’sconfig() 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. Withdelete+insert, records in the model whoseunique_keymatches a staged record are deleted, and then the staged records are inserted. - Snapshots - Snapshots use
NOW()as the snapshot time andSHA256()to generate thedbt_scd_idcolumn. - Seeds - Seed files are loaded in batches of 5,000 records.
- Metadata - Schema, table, and column information is read through the
/show/schemaand/show/tableendpoints.
Limitations
- The
mergeandinsert_overwriteincremental strategies are not supported; usedelete+insertorappendinstead. persist_docsis 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_fieldcan be checked. - Python models are not supported.
Example Project
The adapter’s GitHub repository includes a small example project inexamples/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: