Native Go · Any Chargewire server · Apache-2.0

    The Chargewire ADBC driver

    A generic driver for the Chargewire protocol: it talks to any server that implements Chargewire 1.0, not one particular database. One Go core with Python bindings serves Python, Go, R, C/C++, Rust and other ADBC clients.

    Arrow end to end

    Results stream from the server as Arrow IPC straight into a pyarrow Table, a Go RecordReader or any other ADBC consumer, with no row conversion.

    Built for real networks

    Resumable downloads, safe retries with idempotency keys, asynchronous submit, poll and fetch for long queries behind proxies, and token renewal. A cancel stops the statement on the server.

    TLS by default

    TLS is verified unless you turn it off, and credentials never go in the URI. Mutual TLS, token exchange for SSO and browser sign-in work where the server offers them.

    One C API. Every language.

    The examples on this page are in Python, but ADBC exposes each driver as a C-compatible shared library — so the same native core works from Go, Rust, Java, C#, C/C++, JavaScript, and more. One driver, every stack.

    PythonGoRustJavaC#C / C++JavaScriptRRubyKotlin
    Learn more about Apache Arrow ADBC

    Install and query

    Install the Python package, set your server’s URI and credentials in the environment, and read the results as an Arrow table.

    pip install adbc-driver-chargewire
    1import os
    2from adbc_driver_chargewire import dbapi
    3
    4with dbapi.connect(
    5    uri=os.environ["CHARGEWIRE_URI"],
    6    username=os.environ["CHARGEWIRE_USERNAME"],
    7    password=os.environ["CHARGEWIRE_PASSWORD"],
    8) as conn, conn.cursor() as cur:
    9    cur.execute(operation="SELECT 42 AS answer, ? AS greeting", parameters=["hello"])
    10    print(cur.fetch_arrow_table())

    CHARGEWIRE_URI is chargewire://host:port: HTTPS, with the protocol under /chargewire. Add ?tls=false only for a local development server.

    Load data with bulk ingest

    Bulk ingest takes an Arrow reader, so batches are sent as they are produced. This example creates the table; mode="append" loads into an existing one.

    1import os
    2import pyarrow as pa
    3from adbc_driver_chargewire import dbapi
    4
    5schema = pa.schema([("id", pa.int64()), ("amount", pa.float64())])
    6
    7def batches():
    8    for start in range(0, 4000, 1000):
    9        yield pa.record_batch(
    10            [pa.array(range(start, start + 1000), type=pa.int64()),
    11             pa.array([12.50] * 1000, type=pa.float64())],
    12            schema=schema,
    13        )
    14
    15with dbapi.connect(
    16    uri=os.environ["CHARGEWIRE_URI"],
    17    username=os.environ["CHARGEWIRE_USERNAME"],
    18    password=os.environ["CHARGEWIRE_PASSWORD"],
    19) as conn, conn.cursor() as cur:
    20    with pa.RecordBatchReader.from_batches(schema, batches()) as reader:
    21        rows = cur.adbc_ingest(table_name="orders", data=reader, mode="create")
    22    conn.commit()
    23    print(f"Loaded {rows:,} rows")

    From Go

    Go programs use the driver directly, without a driver manager.

    go get github.com/gizmodata/chargewire-adbc/go/v2
    package main
    
    import (
    	"context"
    	"fmt"
    	"log"
    	"os"
    
    	"github.com/apache/arrow-go/v18/arrow/memory"
    	"github.com/gizmodata/chargewire-adbc/go/v2/chargewire"
    )
    
    func main() {
    	ctx := context.Background()
    	drv := chargewire.NewDriver(memory.DefaultAllocator)
    	db, err := drv.NewDatabaseWithContext(ctx, map[string]string{
    		"uri":      os.Getenv("CHARGEWIRE_URI"),
    		"username": os.Getenv("CHARGEWIRE_USERNAME"),
    		"password": os.Getenv("CHARGEWIRE_PASSWORD"),
    	})
    	if err != nil {
    		log.Fatal(err)
    	}
    	defer db.Close(ctx)
    
    	cnxn, err := db.Open(ctx)
    	if err != nil {
    		log.Fatal(err)
    	}
    	defer cnxn.Close(ctx)
    
    	stmt, err := cnxn.NewStatement(ctx)
    	if err != nil {
    		log.Fatal(err)
    	}
    	defer stmt.Close(ctx)
    	if err := stmt.SetSqlQuery(ctx, "SELECT 42 AS answer"); err != nil {
    		log.Fatal(err)
    	}
    	reader, _, err := stmt.ExecuteQuery(ctx)
    	if err != nil {
    		log.Fatal(err)
    	}
    	defer reader.Release()
    	for reader.Next() {
    		fmt.Println(reader.RecordBatch().Column(0)) // [42]
    	}
    }

    C/C++, R, Rust and other languages

    One line installs the driver’s library and its driver manifest, so every ADBC driver manager on the computer loads it as driver = "chargewire".

    curl https://install.adbc.gizmodata.com/chargewire | sh
    irm https://install.adbc.gizmodata.com/chargewire.ps1 | iex
    Read the driver documentation →

    Chargewire ADBC driver — FAQ

    Which servers does the Chargewire driver work with?

    Any server that implements the Chargewire protocol, version 1 (spec 1.0.0). It is a generic driver, not tied to one database, and it is tested against chargewire-duckdb, the reference server, and Hardcharger.

    Should I use the Chargewire driver or the Hardcharger driver?

    For Hardcharger, use the Hardcharger driver: it is built on this one and adds Hardcharger’s own options, such as query tags and session settings, and hardcharger:// URIs. Use the Chargewire driver for any other Chargewire server, or when you want one driver that is not tied to a particular server.

    Is the Chargewire driver free?

    Yes. It is open source under Apache-2.0.

    Which platforms does it run on?

    The Python wheel carries the driver for Linux on x86-64 and arm64 (glibc 2.17 or newer), macOS 13 or newer on Apple silicon and Intel, and Windows x64. Each GitHub release also has the shared library for Windows Arm64, for the other ADBC languages.

    What is Chargewire?

    An open protocol for SQL over HTTP with Apache Arrow results. The protocol page is gizmodata.com/chargewire.

    Ready to move your data?

    Install Hardcharger for free and use ADBC drivers to stream your first table.

    Schedule a demo!powered by Calendly