A command-line tool for querying databases via ADBC.
- Multi-database support - Connect to any database with a compatible ADBC driver
- Interactive SQL shell - Execute SQL queries with command history and intuitive navigation
- Syntax highlighting - SQL queries highlighted for improved readability
- Formatted output - Results displayed in clean, aligned tables with dynamic column width
- File export - Export query results to JSON, CSV, or Arrow IPC files
- Fast and lightweight - Built in Rust for high performance and minimal resource usage
Install from crates.io:
cargo install adbcli --version 0.1.0-alphaInstall from source:
git clone https://github.com/columnar-tech/adbcli.git
cargo install --path adbcliInstall the DuckDB ADBC driver with dbc:
dbc install duckdbConnect to DuckDB (in-memory):
adbcli --driver duckdbExecute SQL queries:
> CREATE TABLE penguins AS FROM 'https://blobs.duckdb.org/data/penguins.csv';
┌───────┐
│ Count │
├───────┤
│ 344 │
└───────┘
> SELECT *
. FROM penguins
. LIMIT 5;
┌─────────┬───────────┬────────────────┬───────────────┬───────────────────┬─────────────┬────────┬──────┐
│ species │ island │ bill_length_mm │ bill_depth_mm │ flipper_length_mm │ body_mass_g │ sex │ year │
├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼─────────────┼────────┼──────┤
│ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ 3750 │ male │ 2007 │
│ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ 3800 │ female │ 2007 │
│ Adelie │ Torgersen │ 40.3 │ 18 │ 195 │ 3250 │ female │ 2007 │
│ Adelie │ Torgersen │ NA │ NA │ NA │ NA │ NA │ 2007 │
│ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ 3450 │ female │ 2007 │
└─────────┴───────────┴────────────────┴───────────────┴───────────────────┴─────────────┴────────┴──────┘
Execute a query directly and exit:
adbcli --driver duckdb --query "SELECT 42 AS the_answer"Execute a query from stdin and exit:
echo "SELECT 42 AS the_answer" | adbcli --driver duckdbExecute a query from a file and exit:
adbcli --driver duckdb --file select_example.sqlExecute a query and output the result to a file:
adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.json
adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.csv
adbcli --driver duckdb --query "SELECT 42 AS the_answer" --output result.arrow$ adbcli --help
Query databases via ADBC
Usage: adbcli [OPTIONS] --driver <driver>
Options:
--driver <driver> Driver name
--uri <uri> Database uniform resource identifier
--username <username> Database user username
--password <password> Database user password
--option <option> Driver-specific database option
--mode <mode> Table display style [default: utf8-compact]
--query <query> Execute query and exit
--file <file> Read and execute file and exit
--output <file> Write result to file
-h, --help Print help
-V, --version Print versionThis project is licensed under Apache-2.0.