Hacker News new | ask | show | jobs
Show HN: Pam-db – A hybrid TUI <-> CLI tool for SQL databases (github.com)
3 points by xGoivo 144 days ago
I love working in the terminal! In the past few months, I found myself switching more and more of my tools to be cli or tui based. Whenever I have to deal with databases though, I end up switching back to work with GUI tools like dbeaver/datagrip. They are all great, but it feels a little bit much having to spin up these programs just for a quick query.

I've tried existing SQL TUIs like harlequin, sqlit, and nvim-dbee. they're all excellent tools and work great for heavier workflows, but they generally use the same 3-pane (explorer, editor, results) paradigm most of the other GUI tools operate with. I found myself wanting to try a different approach, and came up with pam-db.

Pam's Database Drawer uses a hybrid approach between being a cli and tui tool: cli commands where possible (managing connections and queries, switching contexts), TUI where it makes more sense (exploring results, interactive updates), and your $EDITOR when... editing text (usually for writing queries).

Example workflow with sqlite:

  # Create a connection
  pam init sqlite sqlite3 file:///path/to/mydb.db

  # Add a query with params and default values
  pam add min_salary 'select * from employees where salary > :sal|10000'

  # Run it
  pam run min_salary --sal 300000
This opens an interactive table TUI where you can explore data, export results, update cells, and delete rows. Later you can switch to another database connection using `pam switch <dbname>` and following pam commands will use this db as context.

Features: - Hybrid cli/tui approach - Parameterized saved queries - Interactive table exploration and editing - Connection context management - Support for sqlite, postgres, mysql/mariadb, sqlserver, oracle and more

Built with go and the awesome charm/bubbletea!

Currently in beta, so any feedback is very welcome! Especially on missing features or database adapters you'd like to see.

https://github.com/eduardofuncao/pam

1 comments

That's such cool tool. The parametrized query management/run alone is great idea, and then you've that sweet hybrid cli/tui on top. Then open repo, and was sold even more with that intro.
Thanks a lot, glad you liked it! There's a few the office easter eggs throughout the repo :)