top | item 38882526

Harlequin: SQL IDE for Your Terminal

183 points| jzombie | 2 years ago |github.com | reply

85 comments

order
[+] tconbeer|2 years ago|reply
Author here. Thanks for more love for Harlequin. I’ll be checking back and responding to feedback and questions for the next few hours.
[+] alberth|2 years ago|reply
Looks super impression. Congrats.

A few questions ...

a. what caused you to start working this?

b. any particular reason why you chose to implement it the way you did (e.g. I see you use Python + Textual as opposed to something like https://charm.sh/libs/)

c. any major functionality you feel it's missing?

d. any limitations (e.g. doesn't work with Oracle?)

e. any reason why someone should not use it?

Thanks in advance.

[+] Fuzzwah|2 years ago|reply
Is there a way to order the list of tables in the left hand pane?
[+] diazc|2 years ago|reply
There are also other interesting collections of TUI terminal tools like harlequin here as well:

https://terminaltrove.com/

harlequin is also featured there as a tool of the week on that site.

[+] hodgesrm|2 years ago|reply
I would like to put in a vote for k9s, which is also on the list at Terminal Trove. [0] It's the most convenient tool I've ever found for Kubernetes management. Based on that experience I'll definitely be checking out Harlequin.

[0] https://k9scli.io/

[+] jcuenod|2 years ago|reply
Harlequin has been on my "to investigate" list since it popped up on hn a few weeks/months ago. I still need to experiment with it a bit more, but I had been thinking of building a some tragic equivalent to this, and now I don't have to :)
[+] jadbox|2 years ago|reply
The HN hive mind is amusing as I came here to get to comment this exact post. It looks really interesting, and I'm also tired of giving up so much memory for just a SQL GUI tool.
[+] graemep|2 years ago|reply
I have been looking for a nice SQL TUI and this looks like it. Will give it a try. Thank you.
[+] hans_castorp|2 years ago|reply
pspg is a pager intended to be used with SQL command line clients. It was originally created for Postgres (hence the name), but also works with MySQL and others

https://github.com/okbob/pspg

[+] pmarreck|2 years ago|reply
Every time I notice something is a Python codebase I feel a letdown as it means it will likely break some other Python project from someone else I have on my dev machine which I may not have touched in a while but which I will find got silently broken when I most need it

Especially if it's a nice TUI app like this looks

EDIT: Guys, in my experience, virtual environments do not fix this problem in all cases. At least, not sufficiently for me (after getting used to Nix's guarantees, for example). Not to mention, there's multiple ways/attempts at creating and working with virtual environments: https://twitter.com/pmarreck/status/1735363908515295253). See below comment.

[+] whalesalad|2 years ago|reply
every project you have should be in a virtual environment. it is not hard. https://docs.python.org/3.12/library/venv.html

    python -m venv ~/my-venvs/<name>

    source ~/my-venvs/name/bin/activate

    pip install <package>
but stuff like this would usually get installed globally, and your projects would instead have a venv.

personally my favorite tool is pyenv, which allows you to have many versions of python on your machine as well as many virtualenv (which are assigned to any version you have installed)

then it is as simple as

    pyenv virtualenv <version> <name>
    pyenv virtualenv 3.11.1 xyz
and to activate

    pyenv activate xyz
this allows you to keep every project you have isolated not only to the packages required to run it, but also the python version required.

I work on a handful of projects that run on 3.10, 3.11 and 3.12. Each has their own independent python version, and within that version they also have their own python packages (pip environment).

At the end of the day these are simply directories on disk.

[+] nicoco|2 years ago|reply
Install using pipx to avoid that. (or virtualenvs directly if you don't mind getting your hands dirty)
[+] jzombie|2 years ago|reply
Docker could be an alternative if virtual environments aren't your thing. I'd imagine they would provide a greater degree of isolation, too.
[+] billowycoat|2 years ago|reply
This isn’t an issue if you use virtual environments. See also pipx for installing isolated Python apps.
[+] burgerrito|2 years ago|reply
Wow, this is really good. I can't believe how good terminal app is now.
[+] ComputerGuru|2 years ago|reply
I did not get a chance to give this a whirl yet but I am excited to do so. I mainly used pgcli but it’s pretty buggy and certainly doesn’t approach IDE status.
[+] xwowsersx|2 years ago|reply
Looks great. Is it just DuckDB and SQLite for now? No Postgres?
[+] tconbeer|2 years ago|reply
You can install adapters for pg, MySQL, big query, and trino, with others coming soon. harlequin.sh for more info
[+] alberth|2 years ago|reply
Question: do people love TUI, because they love being in a terminal?

Or ... is this a movement against application bloat, which has become all to common these days?

EDIT: why the downvotes?

[+] MilaM|2 years ago|reply
They are very convenient when I work on remote servers over ssh, even if it's just my server at home. Programs I use regularly (no specific order):

vim ncdu nnn mqqtui htop gitui tmux lnav lazydocker ctop

[+] sprash|2 years ago|reply
If you develop SQL you need to write code and view tables. A grid with monospace characters is perfectly suitable for that.

But other than that, no, people don't love being in a terminal. It just happens that all open source portable toolkits like qt and gtk do not work via ssh and are in general total abominations for developers and users. The vt100 standard is 45 years old and turned out to be the lowest common denominator to write GUIs for better or worse.

[+] dragonelite|2 years ago|reply
I like TUI because it usually works nicely with multiplexer like zellij or tmux. Open a new pane or tab where you can open a new set of TUI apps.

Like have Helix or Nvim open, but you want to quickly check your database queries code changes. You can just open a new tab run the this sql IDE, fire off some queries check the result if it matches go back to coding new features. If not change the code, check queries again etc etc.

[+] nicklecompte|2 years ago|reply
Speaking for myself, it wasn't a "movement against application bloat" so much as a "frustrated response to these darn bloated applications." There wasn't anything ideological about it, I literally ran out of memory a few times when using VSCode. The important thing is that editing plain text works perfectly well in a terminal, whereas you need a modern GUI for most other business-related software.

I switched to emacs during the pandemic because of Zoom and Slack (along with my horrible browser habits). VSCode is pretty reasonable on resources compared to many Electron apps, and I slightly prefer it to emacs in terms of overall experience. But emacs is also good, and there were just too many Zoom calls where my computer ran out of memory, with VSCode having a glaringly high footprint. I think at the time its terminal emulator was either excessively inefficient, or it had a specific resource leak. So maybe things have gotten better, but I've stuck with emacs regardless.

These days I can let a few dozen unread tabs in Firefox fill in the extra ~1GB of memory VSCode was formerly occupying :)

[+] andrewl|2 years ago|reply
I do a lot of work with SQLite, and I do sometimes use one of the GUI clients (specifically sqlitebrowser.org). However, I mostly use the command line client that comes with SQLite, not because of how many features it has (not a lot) but because I use Bash and everything that comes with it, across various sessions managed with Tmux, as part of what I do with SQLite. It’s the same reason I usually use Vim in a terminal session instead of the GUI version. Using the GUI version means stepping away from a lot of my best tools.
[+] FusionX|2 years ago|reply
Another advantage is that TUI apps can be easily used over SSH.
[+] pdimitar|2 years ago|reply
1. I occasionally have to browse databases through SSH. 2. The CLI / TUI apps take less memory. 3. They also don't lag and lag is something I am absolutely sick of. 4. Easy to build habits in terms of blind keyboard pressing (very much like cashiers on the older DOS keyboard-only software in retail shops; you just know where everything is and are times more productive).
[+] tconbeer|2 years ago|reply
I originally wrote this because sometimes a CLI or TUI is just super convenient. I used to use the DuckDB and Sqlite CLIs a lot, but was frustrated by their limitations, especially for doing data analysis work (my background).
[+] TehShrike|2 years ago|reply
I'm not excited about it being a TUI, I'm just excited because it looks reasonable and I haven't found a macOS SQL client for writing queries that I was excited about yet
[+] patja|2 years ago|reply
Suggestion: under "works with your database" consider naming the databases rather than only offering a list of icons.

Also seems to be a bit of hubris to claim a SQL IDE "works with your database" when SQL Server and Oracle, two of the database products with the largest market share, are not supported (yet?)

[+] pmarreck|2 years ago|reply
> SQL Server and Oracle

Alright so first off, for 90% of SQL Server's existence, Microsoft was openly open-source-hostile, so give me a fucking break with this. Microsoft used to be way worse than even Apple about keeping everything in their ecosystem- at least Apple is built on BSD underpinnings and was therefore also always compatible with POSIX stuff.

Oracle... last I checked on that monstrosity it had about 20 different clients all written at different times for different use cases over the long course of Oracle's history. So, which of these 20 different clients should one write a TUI for?

[+] tconbeer|2 years ago|reply
Fair enough (author here). I just launched support for any databases other than DuckDb and published a guide to create adapters for new dbs. I’m expecting the community to step up here, since I’d rather spend my time adding features to Harlequin. ODBC should be coming shortly. The hard part is honestly just having access to a DB server for testing.
[+] boomskats|2 years ago|reply
> SQL Server and Oracle, two of the database products with the largest market share

Agree on the first point, but is 'market share' - a metric comparing commercial sales revenue which by definition excludes open source software, really that relevant when critiquing a tagline for a FOSS tool implicitly targeting FOSS databases at a time when FOSS dominates?

If this wasn't an MIT licensed project without a single hint of a commercial offering I'd get it, but come on.

[+] zozbot234|2 years ago|reply
Looks nice already, but a true "SQL IDE" should also strive for feature parity with existing database frontends like LibreOffice Base, or with old-style MS-DOS/TUI applications for database access which had a similar featureset. Meaning an integrated view of database design, data entry/inspection (with full-screen, form-like views for individual records where appropriate!), custom querying (including a more-or-less seamless integration of QBE and raw SQL) and report generation. Hopefully we're going to see some of this in future releases!