Skip to main content

harlequin-adbc

This repo provides the Harlequin adapter for ADBC (arrow database connectivity).

Warning

ADBC is a very new database connectivity method compared to ODBC, JDBC that aims at providing a more efficient way to transfer columnar data over the wire.

Due to the recency of its development, there is various level of functionality across drivers which may cause issues.

Installation

harlequin-adbc depends on adbc_driver_manager, harlequin and pyarrow, so installing this package with also install these dependencies.

I also recommend installing the extra adbc drivers for the databases you plan on connecting to otherwise you will have to download the driver yourself from another place and provide the driver_path as a cli argument. The driver path connection method hasn't been thoroughly test.

If you don't install the driver but provide a --drive-type cli argument you will get an ImportError

Using pip

To install the adapter using pip into an activated virtual environment:

pip install harlequin-adbc

with one of the driver extras:

pip install harlequin-adbc[snowflake]

Using poetry

poetry add harlequin-adbc

with one of the driver extras:

poetry add harlequin-adbc[snowflake]

Using pipx

If you do not already have Harlequin installed:

pipx install harlequin-adbc

pipx install harlequin-adbc[snowflake]

If you would like to add ADBC adapter to an existing Harlequin installation:

pipx inject harlequin harlequin-adbc

Make sure to also inject the driver package you want as well. The following options are:

  • adbc-driver-flightsql
  • adbc-driver-postgresql
  • adbc-driver-snowflake
  • adbc-driver-sqlite

Example usage:

pipx inject harlequin adbc-driver-snowflake

Usage and Configuration

You can open Harlequin with the ADBC adapter by selecting it with the -a option and passing in a connection string. The format of the connection string will depend on the driver you are using. You will also need to provide either the --driver-type or the --driver-path.

Driver Type (preferred)

When you use the --driver-type option it will try to dynamically use the driver package of the type selected adbc-driver-{driver type}. That is why it's crucial to also have that package also install in the virtual environment where Harlequin is installed.

  • --driver-type with one of the following options
    • flightsql, postgresql, snowflake, sqlite, duckdb

Driver Path

The other option is to pass the file path location of the adbc driver that you are using. Note this method is not well tested.

  • --driver-path

DB Kwargs String (Optional)

Since the drivers implement so many different options to pass through when you connect to the database this is a way to pass through these options. The format of the string is key=value separated by ;

  • --db-kwargs-str

Example: --db-kwargs-str "username=flight_username;password=flight_password;adbc.flight.sql.client_option.tls_skip_verify=true"

This will parse the string and pass through these values into the db_kwargs value in the dbapi.connect() method. Note the parser relies on the ; and = so if any of of the parameters in the string contain either of these characters it's not going to work. This is a known limitation and something being worked on.

Snowflake Driver

The Snowflake URI should be of one of the following formats:

  • user[:password]@account/database/schema[?param1=value1&paramN=valueN]
  • user[:password]@account/database[?param1=value1&paramN=valueN]
  • user[:password]@host:port/database/schema?account=user_account[&param1=value1&paramN=valueN]
  • host:port/database/schema?account=user_account[&param1=value1&paramN=valueN]

Check the Snowflake ADBC Driver Docs for more details.

Example usage:

harlequin -a adbc "$SNOWFLAKE_URI" --driver-type snowflake

FlightSQL Driver

Example usage:

harlequin -P None -a adbc "grpc+tls://localhost:31337" --driver-type flightsql --db-kwargs-str "username=flight_username;password=flight_password;adbc.flight.sql.client_option.tls_skip_verify=true"

Check the FlightSQL ADBC Driver Docs for more details.

Postgres Driver

The Postgres URI should be in the format of a Postgres DSN:

harlequin -a postgres "postgres://my-user:my-pass@localhost:5432/my-database"

DuckDB and SQLite

While DuckDB and SQLite both have ADBC drivers it's not recommend to use them. Harlequin natively supports both of the databases without having to install any other dependencies.

Know Issues

  • Snowflake adbc driver seems to be the only driver that returns the xdbc_data_type from adbc_get_objects()
  • Snowflake adbc driver has a bug with adbc_get_table_schema() that returns adbc_driver_manager.OperationalError: IO: sql: expected 12 destination arguments in Scan, not 11
  • The PostgreSQL adbc driver is overall buggy and when executing queries you might get the error IO: [libpq] Fetch header failed: no COPY in progress
  • SQLite and DuckDB don't have the same level of depth for adbc_get_objects() compared to other dbs which causes weird issues.
  • DuckDB driver uses different names for the adbc_get_objects() which causes things to break.

Metadata

Release files for harlequin-adbc 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harlequin-adbc 0.1.2
File Size Uploaded Provenance Actions
harlequin_adbc-0.1.2.tar.gz 6.7 kB Without provenance Details for harlequin_adbc-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for harlequin-adbc 0.1.2
File Interpreter ABI Platform Actions
harlequin_adbc-0.1.2-py3-none-any.whl Python 3 none any Details for harlequin_adbc-0.1.2-py3-none-any.whl

Total release size: 14.4 kB

Release files / harlequin_adbc-0.1.2.tar.gz

Download URL harlequin_adbc-0.1.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
203f19a78b36045cae482ef4c15c5079d2c9407f4d8738566857e1ebfcec6156
BLAKE2b-256 checksum
How to use checksums
adbdb5edb3a744b015e9455cc00f2902f98768ef91b0ac6aa0f5026afe350c64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.16 Linux/6.8.0-1017-azure

Release files / harlequin_adbc-0.1.2-py3-none-any.whl

Download URL harlequin_adbc-0.1.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
47ffbd7b75f32a837545c92c498d342da03a5808e64465574dfd325b761c4695
BLAKE2b-256 checksum
How to use checksums
1da6a8b208d664a20aef33bfea8008c3d52d59795d77e931ebd809f59de83c8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.16 Linux/6.8.0-1017-azure

Security for harlequin-adbc 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page