dbimp holds Go database/sql drivers for databases that have no idiomatic
Go driver, and for groups of databases that can share one implementation.
usql and dbtpl
use them. The first drivers are for databases that take queries over HTTP.
The drivers use the Go standard library, with
apd for decimals, and need no cgo.
docs/TARGETS.md names the databases it aims to support, and the order of the work.
Each driver is its own package, and there is no package that imports every driver. Import the driver for your database. Open it with the name of the database, and with a URL whose scheme is that name:
import (
"database/sql"
_ "github.com/xo/dbimp/couchbase"
)
db, err := sql.Open("couchbase", "couchbase://user:pass@localhost:8093/")A driver registers one name and knows no alias.
dburl turns an alias, such as n1ql, into the
URL that the driver reads, so every alias works in usql.
To open a database from a URL in one call, import dburl and the drivers that
you need. dburl.Open reads the scheme of the URL, finds the driver, and
returns a *sql.DB. A program can import as many drivers as it needs:
import (
"github.com/xo/dburl"
_ "github.com/xo/dbimp/bigquery"
_ "github.com/xo/dbimp/couchbase"
_ "github.com/xo/dbimp/databricks"
)
bq, err := dburl.Open("bigquery://my-project/my_dataset?credential_file=/path/key.json")
cb, err := dburl.Open("couchbase://user:pass@localhost:8093/")
dbx, err := dburl.Open("databricks://token:dapi-secret@dbc-1234.cloud.databricks.com/warehouse-id?catalog=main&schema=default")The URL of each driver, with its keys and its credential, is in its document. BigQuery and Spanner read the path of a key file. Databricks reads a token as the password of the URL.
Each row is a driver that a release holds. The name of the driver links to its page on pkg.go.dev, and the version links to the release that first held it.
| Driver | Database | First released in |
|---|---|---|
couchbase |
Couchbase | v0.1.0 |
surrealdb |
SurrealDB | v0.2.0 |
neo4j |
Neo4j | v0.3.0 |
influxdb |
InfluxDB | v0.4.0 |
arangodb |
ArangoDB | v0.5.0 |
databend |
Databend | v0.6.0 |
pinot |
Apache Pinot | v0.7.0 |
rqlite |
rqlite | v0.8.0 |
libsql |
libSQL and Turso | v0.9.0 |
avatica |
Apache Phoenix and Calcite Avatica | v0.10.0 |
druid |
Apache Druid | v0.11.0 |
trino |
Trino and Presto | v0.12.0 |
clickhouse |
ClickHouse | v0.13.0 |
drill |
Apache Drill | v0.14.0 |
solr |
Apache Solr | v0.14.0 |
elasticsearch |
Elasticsearch | v0.14.0 |
opensearch |
OpenSearch | v0.14.0 |
dynamodb |
Amazon DynamoDB | v0.14.0 |
snowflake |
Snowflake | v0.16.0 |
databricks |
Databricks | v0.17.0 |
bigquery |
Google BigQuery | v0.17.0 |
athena |
Amazon Athena | v0.17.0 |
cosmos |
Azure Cosmos DB | v0.17.0 |
spanner |
Google Cloud Spanner | v0.17.0 |
exasol |
Exasol | v0.20.0 |
| Document | Holds |
|---|---|
| CONTRIBUTING.md | How to change this repository |
| AGENTS.md | The rules, written for a coding agent. They apply to a person too |
| CLAUDE.md | One line that imports AGENTS.md for Claude Code |
| docs/PLAN.md | The purpose of the project, and the open questions |
| docs/decisions/README.md | Every decision, one file each, and their index |
| docs/TARGETS.md | Every target database, its priority, and the review of the list |
| docs/DRIVER.md | Every step to add a driver, in order |
| docs/TYPES.md | The kinds of type, the Go type of each, and the types of every driver |
| docs/DESIGN.md | The design of the code that every driver shares |
| docs/COUCHBASE.md | What is measured about the Couchbase query service |
| docs/SURREALDB.md | What is known about the HTTP interface of SurrealDB |
| docs/NEO4J.md | What is known about the HTTP interface of Neo4j |
| docs/AVATICA.md | What is known about Apache Calcite Avatica and the Phoenix Query Server, measured for its driver |
| docs/INFLUXDB.md | What InfluxDB 1, 2 and 3 answer, as measured on seven releases |
| docs/CRATEDB.md | What is known about CrateDB, and the work toward its driver |
| docs/ARANGODB.md | What ArangoDB 3.12 answers, as measured |
| docs/DATABEND.md | What Databend 1.2.881 and 1.2.948 answer, as measured |
| docs/TDENGINE.md | What TDengine answers, as measured, and why it has no driver here |
| docs/PINOT.md | What Apache Pinot 1.4.0 and 1.5.1 answer, as measured |
| docs/RQLITE.md | What is known about rqlite, measured for its driver |
| docs/LIBSQL.md | What is known about libSQL and Turso, measured for its driver |
| docs/DRUID.md | What is known about Apache Druid, for its driver |
| docs/DRILL.md | What is known about Apache Drill, for its driver |
| docs/SOLR.md | What is known about Apache Solr, for its driver |
| docs/ELASTICSEARCH.md | What is known about Elasticsearch, for its driver |
| docs/OPENSEARCH.md | What is known about OpenSearch, for its driver |
| docs/DYNAMODB.md | What is known about Amazon DynamoDB and ScyllaDB Alternator, for its driver |
| docs/PROGRESS.md | Where the work in progress stands, and how to resume it after a crash |
| docs/TRINO.md | What is known about Trino and Presto, for their driver |
| docs/CLICKHOUSE.md | What is known about ClickHouse over HTTP, for its driver |
| docs/VOLTDB.md | What is known about VoltDB, and why it has no driver here |
| docs/SNOWFLAKE.md | What is known about Snowflake over its SQL REST API, for its driver |
| docs/BIGQUERY.md | What is known about Google BigQuery over its REST API, for its driver |
| docs/COSMOS.md | What is known about Azure Cosmos DB over its REST API, for its driver |
| docs/ATHENA.md | What is known about Amazon Athena over its API, for its driver |
| docs/DATABRICKS.md | What is known about Databricks over its SQL Statement Execution API, for its driver |
| docs/EXASOL.md | What is known about Exasol over its WebSocket API, for its driver |
| docs/SPANNER.md | What is known about Google Cloud Spanner over its REST API, for its driver |
| docs/BACKLOG.md | The planned work, in order |
dbimp is one of the xo projects for databases. Each one is a separate
repository:
| Project | What it is |
|---|---|
| usql | A command line client for SQL and NoSQL databases, modeled on psql. It uses the drivers of dbimp |
| dburl | Parses the URL of a database, and names the driver that opens it. It gives each driver of dbimp its DSN |
| dbmeta | Reads the metadata of a database: its schemas, tables, columns and the rest. Its command dbrun starts the servers that the tests of dbimp use |
| dbtpl | Generates Go code from the schema of a database. It reads the schema through dbmeta |
| dbimp | This repository: database/sql drivers for databases that have no idiomatic Go driver |
| cassandra | The database/sql driver for Cassandra, formerly cql |
| tblfmt | Writes a result set as a text table, one row at a time. usql uses it |
| rline | A readline package for Go, which reads a line of text that a person edits. usql uses it |
| transit | A Go port of tree-sitter, a parser of source code. rline uses it to highlight syntax, and usql to complete statements |