A terminal-based SQL IDE for DuckDB
Project description
harlequin
A Terminal-based SQL IDE for DuckDB.
(A Harlequin is also a pretty duck.)
Installing Harlequin
After installing Python 3.8 or above, install Harlequin using pip or pipx with:
pipx install harlequin
Tip:
You can run invoke directly with
pipx runanywhere thatpipxis installed. For example:
pipx run harlequin --helppipx run harlequin ./my.duckdb
Using Harlequin
From any shell, to open a DuckDB database file:
harlequin "path/to/duck.db"
To open an in-memory DuckDB session, run Harlequin with no arguments:
harlequin
You can also open a database in read-only mode:
harlequin -r "path/to/duck.db"
Viewing the Schema of your Database
When Harlequin is open, you can view the schema of your DuckDB database in the left sidebar. You can use your mouse or the arrow keys + enter to navigate the tree. The tree shows schemas, tables/views and their types, and columns and their types.
Editing a Query
The main query editor is a full-featured text editor, with features including syntax highlighting, auto-formatting with ctrl + ` (ctrl + 2 on some terminals), text selection, copy/paste, and more.
You can save the query currently in the editor with ctrl + s. You can open a query in any text or .sql file with ctrl + o.
Running a Query and Viewing Results
To run a query press ctrl + enter. Not all terminals support this key combination, so you can also use ctrl + j, or click the RUN QUERY button in the (blue) footer.
Up to 50k records will be loaded into the results pane below the query editor. When the focus is on the data pane, you can use your arrow keys or mouse to select different cells.
Exiting Harlequin
Press ctrl + q to quit and return to your shell.
Contributing
Thanks for your interest in Harlequin! Harlequin is primarily maintained by Ted Conbeer, but he welcomes all contributions and is looking for additional maintainers!
Providing Feedback
We'd love to hear from you! Open an Issue to request new features, report bugs, or say hello.
Setting up Your Dev Environment and Running Tests
- Install Poetry v1.2 or higher if you don't have it already. You may also need or want pyenv, make, and gcc.
- Fork this repo, and then clone the fork into a directory (let's call it
harlequin), thencd harlequin. - Use
poetry install --syncto install the project (editable) and its dependencies (including all test and dev dependencies) into a new virtual env. - Use
poetry shellto spawn a subshell. - Type
maketo run all tests and linters, or runpytest,black .,ruff . --fix, andmypyindividually.
Opening PRs
- PRs should be motivated by an open issue. If there isn't already an issue describing the feature or bug, open one. Do this before you write code, so you don't waste time on something that won't get merged.
- Ideally new features and bug fixes would be tested, to prevent future regressions. Textual provides a test harness that we use to test features of Harlequin. You can find some examples in the
testsdirectory of this project. Please include a test in your PR, but if you can't figure it out, open a PR to ask for help. - Open a PR from your fork to the
mainbranch oftconbeer/harlequin. In the PR description, link to the open issue, and then write a few sentences about why you wrote the code you did: explain your design, etc. - Ted may ask you to make changes, or he may make them for you. Don't take this the wrong way -- he values your contributions, but he knows this isn't your job, either, so if it's faster for him, he may push a commit to your branch or create a new branch from your commits.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file harlequin-0.0.13.tar.gz.
File metadata
- Download URL: harlequin-0.0.13.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.12 Linux/5.15.0-1039-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
889f08809f0259b91bd35fe9ccd9b555ab311476e462e8888a61754bca6990fe
|
|
| MD5 |
d6e9aca35e1ddb4f481819eb32044989
|
|
| BLAKE2b-256 |
8d7d57af45882bfd3eef49ce65f9a63e6d757b318a8e4e77a942b21acb841265
|
File details
Details for the file harlequin-0.0.13-py3-none-any.whl.
File metadata
- Download URL: harlequin-0.0.13-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.12 Linux/5.15.0-1039-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcdf95dc4ad6902b87ddf23d52ae9272eff26083a813c5bbeafe880d5bde0e7f
|
|
| MD5 |
e655af78c076eab8b973bb3856da0634
|
|
| BLAKE2b-256 |
e00e0d00f8aca51eaa317c7a1728206f6fdf7741c920f3d4efee8f0d9bf2cb51
|