Skip to main content
Kinetica provides an Arrow-native SQL interface through its ADBC (Arrow Database Connectivity) driver, which runs on Linux, Mac, & Windows. Query results arrive from the database as Arrow record batches, with no row-by-row conversion in between, and bulk loads go directly to the worker ranks that hold each row. The driver is built on the Kinetica Rust API. Clients that can’t use ADBC can connect using the JDBC Connector or the PostgreSQL Wire Protocol. For details on the extent of SQL compliance, see the SQL section.

Requirements

The driver requires Kinetica 7.2.3.24 or later, the first version to return query results as Arrow. A connection to an older server is refused when it opens, with an error naming the version found and the version needed. The driver’s version follows Kinetica’s: the 7.2.<X> releases are for Kinetica 7.2, with <X> counting the driver’s own releases.

Installation

Python

The driver is available on PyPI as a package that bundles the driver for the local platform with the ADBC driver manager:
To add pandas support for fetch_df:
To take every release for Kinetica 7.2 and none for a later version:
Wheels are published for Linux (x86-64 & ARM64), Mac (Apple silicon), & Windows (x86-64), for Python 3.11 or later.
There is no Windows ARM64 wheel, as pyarrow publishes none; on that platform, use the x86-64 wheel under an x86-64 Python, or install the driver with dbc, below.

Other Languages

The driver is built & distributed by the ADBC Driver Foundry for Linux, Mac, & Windows, and can be installed for every language at once with dbc:
Any language with an ADBC driver manager (Go, R, C/C++, Java, DuckDB, Polars, etc.) then loads the driver by name, kinetica. The driver can also be loaded directly from its shared library:
  • Library: libadbc_driver_kinetica.so (Linux), libadbc_driver_kinetica.dylib (Mac), or adbc_driver_kinetica.dll (Windows)
  • Entrypoint: AdbcDriverKineticaInit
Release archives for each platform are available from the driver repository on GitHub, which also holds the driver’s source. The Foundry driver page carries the Foundry’s own reference for the driver.

Rust

Rust applications can use the driver’s native API directly, as a git dependency on the driver repository:
Dependency
The crate’s driver_exporter feature, on by default, also builds the C ABI that the ADBC driver manager loads; Rust-only consumers can turn it off with --no-default-features.

Connecting

ADBC Applications

A connection takes the URL of the Kinetica database server as its uri, with a username & password. Every other setting is an option named kinetica.<option>; see ADBC Configuration. To create a connection from Python, using the bundled driver:
The connection returned is a standard ADBC one, so everything the ADBC Python documentation describes works with it. To create a connection through the ADBC driver manager, after installing the driver with dbc (this requires adbc-driver-manager 1.8 or later, which finds a driver by name):
Driver Manager
To create a connection from Rust, using the driver’s native API:
Rust
The driver must not be called from inside an asynchronous Tokio context; a Rust application running under Tokio calls it from a blocking task.

Connection URI

The uri may also be a kinetica:// URI, by which a driver manager given only the URI knows to load this driver. The URI connects over HTTPS unless it says tls=false, and every other query parameter is a driver option under its own name; an option set directly takes precedence over the URI’s.
Connection URI

Secure Connections

When connecting to a Kinetica instance over HTTPS, the uri should reference the database’s secure address, and the driver validates the server’s certificate against the system’s trusted certificates.
See Connection Options for additional parameters that may be necessary to use when connecting over SSL.
To validate against a custom trust store instead, set kinetica.trust_store_path (and kinetica.trust_store_password, if the store has one). To accept the server’s certificate without checking it, set kinetica.bypass_ssl_cert_check to true; prefer a trust store wherever the certificate can be trusted.

Failover Connections

When connecting to a Kinetica instance with one or more failover clusters, the uri should be updated to contain a comma-delimited list of head node addresses for all clusters. The URL of the primary cluster can also be specified. List all cluster head node addresses in the uri and add a kinetica.primary_url option designating the cluster that should be tried first.
By default, the driver discovers the rest of the HA ring from the first cluster it reaches, fails over to another cluster when one fails, and returns to the primary once it is reachable again. See Connection Options for the options governing each.

Other ADBC Clients

Any tool that loads ADBC drivers can use the Kinetica driver, once it is installed with dbc or the shared library is placed where the tool can find it. The following is the general driver and connection information that should be used when configuring a client.
  • Driver: kinetica, or the path to the downloaded shared library
  • Entrypoint: AdbcDriverKineticaInit
  • Connection URI:
See ADBC Configuration for additional configuration parameters.

Using the Driver

The following examples use the Python package; the same operations are available through every ADBC driver manager.

Querying Data

A cursor executes any Kinetica SQL and returns the result as Arrow. Rows can be fetched one at a time, but for a large result, take the Arrow table or data frame directly:
Query
Parameters use ? placeholders and are bound as Arrow values:
Parameters
A query bound to several rows of parameters runs once for each row, and the results are returned as one stream. A large result is paged from a server-side result table, so every page reads one consistent snapshot of a single execution. kinetica.query.batch_size sets the rows requested per page and kinetica.query.max_rows caps the rows returned; see Query Options.
After execute() of an INSERT, UPDATE, or DELETE, the cursor’s rowcount is -1, as the driver cannot return a count alongside a result stream; executemany() reports it correctly. The count is also available from the statement as kinetica.count_affected; see Statement Results.

Loading Data

Data can be inserted with SQL, as with any other client:
Insert
For anything more than a few rows, hand over an Arrow table and let the driver route it to the worker ranks, using distributed ingest:
Bulk Load
The mode is one of:
  • append = Add the rows to an existing table
  • create = Create the table from the Arrow schema, failing if it exists
  • create_append = Create the table if it does not exist, then add the rows
  • replace = Drop any existing table and create it from the Arrow schema
A plain INSERT INTO ... VALUES (?, ...) with bound rows also goes directly to the worker ranks; an INSERT with expressions, a SELECT source, or an ON CONFLICT clause is executed by the server. A local file can be loaded with INSERT INTO … SELECT … FROM FILE, which the driver reads on the client and sends to the worker ranks; the file options are listed under Ingest Options:
Load File
A load is not transactional: when a load fails part-way, the rows already sent remain in the table, and the error reports how many rows were loaded.

Reading the Catalog

The standard ADBC metadata calls return the catalog as Arrow, including primary & foreign keys, with the table & columns each foreign key points at:
Catalog
Filters are LIKE patterns. Kinetica has a single, unnamed catalog.

Transactions

Kinetica has no multi-statement transactions. Autocommit is always on, and a statement has taken effect by the time it returns. By default, commit() & rollback() are refused, and the Python driver manager warns once:
The connection works normally after the warning. A tool that insists on calling them can have them accepted and ignored instead, by setting kinetica.fake_transactions to true.

Sessions & Temp Tables

A connection is a server session, and the session temp tables it creates belong to that session alone; closing the connection drops them.
Temp Table
To share temp tables among connections, set kinetica.session_id on each to the same ID; every connection given the same ID sees the same tables. A session named this way is left in place when a connection closes, for its owner to drop. The SQL session statements SET USER, EXECUTE AS USER, REVERT, SET SCHEMA, & SET CATALOG are also available, for tools that can only send SQL.

Data Types

The Arrow type of each result column is chosen by the server, so a table read through the driver and written back arrives as it left. Every result column also carries the Kinetica type as its SQL writes it (e.g., VARCHAR(16) or DECIMAL(10,2)) under the field metadata key KINETICA:type, with the column’s properties & nullability under KINETICA:properties & KINETICA:nullable. When loading data, the mapping runs in reverse: an Arrow timestamp of any unit is stored as milliseconds; a timestamp with a time zone becomes a TIMESTAMP and one without becomes a DATETIME; decimal256 is stored as DECIMAL; and the extension types above map back to their Kinetica types. A table the driver creates from an Arrow schema uses the same mapping for its column types.

ADBC Configuration

Configuration parameters are passed as options when the database handle is created (db_kwargs in Python), or as query parameters of a kinetica:// connection URI; an option set directly takes precedence over the URI’s. A boolean option takes true or false. Each option is set on the database unless noted otherwise; an option set on the database is inherited by its connections. Some settings of note follow.

Connection Options

Authentication Options

Password authentication is the default. For OAuth, either hand over a token the caller acquired itself, or name a grant and let the driver acquire one. See HTTPS Connections with OIDC/OAuth Authentication for the server-side setup. An acquired token is held for the process and renewed before it expires; concurrent connections wanting the same token sign in once between them. The token is settled when the connection is opened and not revisited, so a connection held open longer than its token’s lifetime will start failing; open a new one rather than expecting it to recover.
Client Credentials

Query Options

The following are optional parameters that could be used to override the default settings, which are set by the server. See the Configuration Reference for more information on configuring the SQL Engine server-side. Each is sent with every statement, but only when set, so an unset one leaves the server’s own default in place. Each can be set on the database or a connection.

Ingest Options

The following govern bulk loads via adbc_ingest, a bound INSERT INTO ... VALUES, and INSERT INTO ... SELECT ... FROM FILE. Each can be set on the database or a connection. The following options read a local file loaded by INSERT INTO ... SELECT ... FROM FILE. A statement can also give each in its own WITH OPTIONS (...) clause, as file read followed by the option’s last part (e.g., file read limit = 100), which takes precedence over the connection’s.

Statement Results

The following are read from a statement after it runs (get_option_int on the statement, or the adbc_statement of a Python cursor), as the ADBC interface has no room for them on a call that also returns a reader.

kinetica.count_affected

Rows the last statement changed, or -1 if it was a query

kinetica.total_number_of_records

Rows the last statement’s whole result holds, however many have been read so far, or -1 if it produced no result. A query bound to several rows of parameters runs once for each, and this adds up the runs made so far. Also available as the standard adbc.statement.exec.max_progress option.

kinetica.key_lookup

1 if the last read was answered by the rank holding its row, 0 if it went through the SQL engine

Logging

The driver logs through the kinetica.log_level & kinetica.log_path options; see Connection Options. A host program that has installed a logger of its own keeps it. Kinetica logs inbound SQL requests, internal calls made on behalf of those requests, and other debugging information. These logs can be found in the following log files:
  • /opt/gpudb/core/logs/host-manager-<hostname>-<datetime>.log: Contains all endpoint calls, including the initial call to /execute/sql and any endpoint calls made as a result of servicing the request
  • /opt/gpudb/sql/logs/sql-engine-<kinetica-hostname>.log: Contains detailed error messages