🦆 OpenDuck
The Modern, Lightning-Fast Terminal SQL IDE & Data Explorer for DuckDB
OpenDuck brings the power and speed of DuckDB straight to your terminal in an intuitive, multi-tab Text User Interface (TUI). Effortlessly browse files, inspect datasets, write queries with full syntax highlighting, sort and filter millions of rows in milliseconds, and export results — all without leaving your shell.
✨ Features
- ⚡ Instant File Queries: Click or select any file (
.csv,.parquet,.xlsx,.json,.duckdb,.sqlite,.arrow) from the sidebar to instantly load and execute queries with zero boilerplates. - 🎨 Rich SQL Syntax Highlighting: Tree-sitter powered VS Code Dark styling with real-time token highlighting for SQL keywords, strings, numbers, identifiers, and comments.
- 🚀 Asynchronous & Non-Blocking: Queries execute in dedicated background threads — the interface remains buttery smooth and never freezes, even on heavy multi-gigabyte queries.
- 📑 Multi-Tab Workspace: Work with multiple datasets simultaneously with tab navigation, close buttons (
✕), and tab titles dynamically bound to files and queries. - 📊 Interactive Data Viewer:
- Sort columns ascending/descending with clickable headers (safe null handling).
- Quick column filters.
- Live query execution runtime, row count, and memory consumption stats.
- 📋 Terminal & System Clipboard Integration:
- Copy highlighted cells or entire rows (
Ctrl+C). - Copy full query results as TSV (
Ctrl+A). - Native terminal copy & paste with multi-level Undo/Redo (
Cmd+Z/Ctrl+Z/Ctrl+Y). - Toggle SQL comments effortlessly (
F3/Cmd+/).
- Copy highlighted cells or entire rows (
- 💾 One-Click Export: Export results to
.csvor.xlsxfiles with a single click. - 📜 History & Saved Queries: Automatically preserves query history and lets you save reusable named queries with quick one-click recall into your editor.
- 🎛️ Draggable Resizable Sidebar: Adjust the width of your sidebar on the fly with mouse drag.
- 🛡️ Intelligent Error Diagnostics: Corrupted file, wrong delimiter, permission issue, or missing dataset? OpenDuck identifies the exact cause and displays human-readable actionable solutions.
- 🐇 Easter Egg: Secret Matrix rain screensaver!
📂 Supported File Formats
OpenDuck automatically recognises and formats queries for:
| Format | Extensions | Query Mode |
|---|---|---|
| Parquet | .parquet |
Native direct query |
| Arrow | .arrow |
Native direct query |
| CSV & GZ | .csv, .csv.gz |
read_csv_auto(...) |
| JSON & JSONL | .json, .jsonl |
read_json_auto(...) |
| Excel | .xlsx, .xls |
In-memory table registration (pandas + openpyxl) |
| SQLite | .sqlite, .sqlite3, .db |
Automatic SQLite extension attach |
| DuckDB | .duckdb |
Database attach & table explore |
🚀 Quickstart
1. Installation
Via PyPI:
pip install openduck-cli
From source:
git clone https://github.com/klandermans/openduck.git
cd openduck
pip install -r requirements.txt
# or: pip install -e .
Note:
textual[syntax]installs the requiredtree-sitterandtree-sitter-sqlengines for syntax highlighting out of the box.
2. Run OpenDuck
python openduck.py
Or make it available system-wide as a command:
chmod +x openduck.sh
sudo cp openduck.sh /usr/local/bin/openduck
openduck
⌨️ Keyboard & Mouse Shortcuts
| Shortcut | Description |
|---|---|
Ctrl+Enter / Cmd+Enter |
Run Query (runs selection if text is selected, or full editor) |
Ctrl+S / Cmd+S |
Save Query with custom name to openduck.json |
F3 / Cmd+/ / Ctrl+/ |
Toggle SQL Comment (--) on current line or selection |
Ctrl+Z / Cmd+Z |
Undo last edit |
Ctrl+Y / Cmd+Shift+Z |
Redo undone edit |
Ctrl+W / Cmd+W |
Close Current Tab |
Ctrl+M |
Toggle Mouse Mode (switch between TUI mouse and native terminal text selection) |
Ctrl+C / Cmd+C |
Copy (Editor selection, or table row/cell to system clipboard) |
Ctrl+A / Cmd+A |
Copy Table (when focused on results) / Select all (in editor) |
F1 |
About Dialog (click the duck for a surprise! 🕶️) |
Ctrl+Q / Cmd+Q |
Quit OpenDuck |
⚙️ Configuration & Storage
OpenDuck automatically manages openduck.json in your working directory. It persists:
- The last 200 executed queries in chronological order.
- Your named saved queries.
- Database configurations.
{
"history": [
{
"sql": "SELECT * FROM read_csv_auto('sales.csv') WHERE revenue > 1000 LIMIT 100;",
"timestamp": "2026-10-14T15:30:00.123456"
}
],
"saved_queries": [
{
"name": "Q3 Revenue by Region",
"sql": "SELECT region, SUM(amount) FROM read_parquet('data/*.parquet') GROUP BY region;",
"timestamp": "2026-10-14T15:32:00.654321"
}
],
"connections": []
}
💡 Tips & Tricks
- Click to Query: Clicking any file in the left sidebar automatically populates the query into your active tab, updates the tab name, and executes the preview.
- Run Selection Only: Highlight any part of your SQL script and press
Ctrl+Enterto run only the highlighted snippet — just like in DBeaver, DataGrip, or VS Code! - Selective Comments: Select multiple lines and press
F3orCmd+/to comment or uncomment SQL blocks simultaneously. - Instant Clipboard Sharing: Results copied via
Ctrl+CorCtrl+Aare immediately synced to your macOS (pbcopy), Linux (wl-copy/xclip), or Windows clipboard.
📁 Project Structure
openduck/
├── openduck/ # Core Python package
│ ├── __init__.py # Package entry and exports
│ ├── __main__.py # CLI invocation (python -m openduck)
│ ├── main.py # Application bootstrap & logging setup
│ ├── core/ # Core logic & backend
│ │ ├── config.py # Config persistence, query history, saved queries
│ │ ├── clipboard.py # Cross-platform system clipboard integration
│ │ ├── sql_utils.py # SQL formatting, file-to-query mapper, comments
│ │ └── error_classifier.py # Diagnostic error classifier
│ └── gui/ # Textual user interface
│ ├── app.py # Main DuckCLI application
│ ├── styles.py # Textual CSS stylesheets
│ ├── screens/ # Modal screens (About, Matrix screensaver)
│ ├── dialogs/ # Modal dialogs (Save Query, Export, Add DB)
│ └── widgets/ # Custom widgets (Editor, ResultsTable, Trees, etc.)
├── docs/ # Documentation & guides
├── scripts/ # Build scripts & packaging specs
├── tests/ # Automated test suite
├── samples/ # Sample datasets for testing & exploration
├── openduck.py # Root executable script
├── openduck.sh # Shell launcher script
└── pyproject.toml # Python package configuration
📜 License
Distributed under the MIT License. See LICENSE for details.
Metadata
Release files for openduck-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openduck_cli-0.1.0.tar.gz | 35.1 kB | With provenance | Details for openduck_cli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openduck_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for openduck_cli-0.1.0-py3-none-any.whl |
Total release size: 70.5 kB
Release files / openduck_cli-0.1.0.tar.gz
| Download URL | openduck_cli-0.1.0.tar.gz |
|---|---|
| Size | 35.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b7e193981089def9107e32b656e5b58f700ccd12c5645a32908729acfd7f9af
|
|
BLAKE2b-256 checksum How to use checksums |
6afaddfa14a1221f892bda245a16ba844d108e7e696e64f64ad3ee944ed64b2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / openduck_cli-0.1.0-py3-none-any.whl
| Download URL | openduck_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 35.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4116805096ae4e748817e33e9d8ff17a87ea0078f8117aa99f8557214fed469
|
|
BLAKE2b-256 checksum How to use checksums |
1ded4b63d752b792adc351630b1547706a7d24a3ccc53d365b994715f558af2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for openduck-cli 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for openduck_cli-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA 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.