Rainfrog – a database management TUI for Postgres
github.com
github.com
Asking because running queries, history, formatting of results etc. can be achieved by configuring psqlrc.
- results are formatted nicely by default; no more doing a first query, getting too many columns so results wrap unreadably, then changing the columns for a second query, and so on
- manually editing rows is as easy as with a spreadsheet; of course hopefully you don't have to do this often...
- I can change common filters & sorts in the UI with a few clicks instead of having to change SQL; sure, the SQL would only require typing a few characters, but if it's 2 clicks vs. 8 characters, it's still a small win
Downsides are:
- the GUI has an interface for saving queries, but it refuses to let me save them to a subfolder of my project; it wants to save them all in some global location. This doesn't seem good for sharing queries
- if you are doing more complicated sorting or aggregation, it's still easier to just go to psql than to fiddle with the GUI
another one is a more comfortable editing experience for queries
rainfrog --url $(heroku config:get DATABASE_URL -a simonwillisonblog)I pretty much always use DataGrip or pgcli and don't see that changing, but will keep an eye on this.
Not sure if that would be a viable option in Rust.
Ref: https://www.gnu.org/software/bash/manual/html_node/Bash-Vari...
https://github.com/achristmascarl/rainfrog/blob/main/src/app...
This seems mostly ok. The only thing that (imo) wouldn't pass code review is that big honking loop at https://github.com/achristmascarl/rainfrog/blob/main/src/app.... That thing needs to be refactored down to be readable, with individual logic chunks being put into their own functions and tidied up a bit.
That's not really Rust-specific, obviously, but all the `match` and `if let` and whatever other Rust stuff looks fine, so it's what I've got.
What do you use for the DataTable widget? Is there a Rust/Ratatui equivalent of DataTable (https://textual.textualize.io/widgets/data_table/) used by Harlequin?
--
If I loose a connection I used to get a little popup in the bottom right corner when I try to execute a query, explaining why it's not executing.
They now popup in the middle of the screen and are much larger. I remember I had to close them by hand at some point, but maybe I'm wrong because I just reproduced it and they closed themselves quickly.
Only this little popups annoy me. The bigger child windows behave the same.
(The 2-3 child windows that show on app startup --flash, tip-of-the-day, and another one-- are quite annoying though and according to my colleagues it's not possible to enforce a setting that stop them from showing; but these were already annoying on Xorg)
Just to confirm - this happens with the older version of DBeaver, running on the newer version of MacOS, right? You didn't upgrade DBeaver, meanwhile, I assume?
\c
\d
\di
\dt
And the variants (e.g. \dti+)I've been wanting to get into building a TUI but can't decide which library to pick.
Charm/bubbletea toolstack, is very much focused on an ELM style architecture, I.e. message passing and deriving UI from state. You can still do immediate type UI if that is what you prefer, but it won't fit with any of the standard components. Bubbletea is a framework more or less, so even if you know Go, it will require you to learn how to build to its strengths.
Ratatui is by default not very opinionated about how to handle state and updates, which requires some development from you, or using a third party library to get an opinionated architecture around it. Ratatui is more of a collection of libraries, out of the box, it expects a certain interface for components, but it is up to you how you want to compose them together. Whether that is immediate-, stateful-, react-, or ELM style. Stateful is the default for all their examples.
Charms way of doing terminal UI is very much based around strings, which can sometimes give issues with spacing, as components can be fiddly to be constrained within a certain space.
Ratatui creates UI on top of a matrix of bytes, which makes it more difficult to do easy things, but allows you to more easily build complex uis.
Generally I prefer Ratatui, as you can really build robust and fast uis on top of it. It does take a bit more work to get started though. I am also biased by Rust tho.
The lack of opinionated approach stems from Ratatui being not a framework, but a library (you call us, we don't call you), and not having any of the event/input handling things included.
There's likely room for a framework or two on top of it.