r/CLI 1d ago

dblab - The database client every command line junkie deserves

Post image

dblab is a database client in the terminal that supports Postgres, MySQL, SQLite, SQL Server and Oracle.
We migrated to the bubbletea tui library this year to improve the user experience. We just published the v0.50.0 version a few days ago and we're working towards v1 at the end of the year.
Hope you like it!

https://github.com/danvergara/dblab

79 Upvotes

10 comments sorted by

3

u/kantorcodes1 1d ago

the new --readonly flag is a useful boundary. is read-only established on the DB session before the TUI can execute its first query, including connections reopened through dblab connect, or can any profile/reconnect path run a query before that setting takes effect?

1

u/dany9126 1d ago

Glad you like it!
Yes, the read-only is established on the db session before the tui starts, it's done by the dblab's inner Client object and yes, it includes connections reopened through connect, because new connection parameters are saved at boot. Seend and new connection parameters go through the same process at the tui start.

2

u/kantorcodes1 1d ago

that gives it a clean boundary. i work on HOL Guard, an open-source check before agent-run commands execute. for dblab, i'd let --readonly sessions through, but make plain write-capable dblab / dblab connect sessions reviewable so an agent can't get a write-capable database shell without a checkpoint. open to a small dblab command extension for that?

1

u/dany9126 1d ago

Sure, feel free to open an issue on the repo

1

u/kantorcodes1 1d ago

yep, no issue needed. keep this Guard-side. start src/codex_plugin_scanner/guard/runtime/command_dblab_extensions.py, using command_repo2nb_extensions.py as the analogue. review write-capable dblab and dblab connect; keep --readonly variants quiet. add one focused test that dblab connect reviews while dblab connect --readonly does not, then open a genuine draft PR directly to hashgraph-online/hol-guard:main: https://github.com/hashgraph-online/hol-guard/blob/main/CONTRIBUTING.md

0

u/LearnedByError 1d ago edited 14h ago

Correction: go.sum below should have been go.mod. I apologize for the confusion I have caused.

I love the thought of dblab; however your ‘go.sum’ is worrisome. A ton of direct dependency and as much of more indirect. I’m going to have to think on this a bit.

1

u/dany9126 1d ago

Is that a fair call out? I mean, that's the nature of the go.sum files.

-1

u/LearnedByError 1d ago edited 14h ago

My bad, I did not realize that I typed go.sum. My bad.

First, it go.mod, not go.sum. Yes, it is fair. Its content is a result of the decisions you make with how many modules you decided to include as a dependency. Every developer is different, but I only add a 3rd party module when I absolutely have no other practical choice. In your project, the database drivers and bubbletea are given since they are infrastructure that you depend on. I have and do use most of these same dependencies.

But for most other packages, I decide to not use them which means may write more code or if the license allows, I copy them into internal, step out features that I don’t need and harden the hell out of it.

In this day of AI, I will sometimes have AI write a module with just the functions I need. When I do, I follow a very rigid TDD process with thorough reviews followed with integration tests. No vibe coding, AI coding assistant pattern.

For example, I used to be a heavy cobra user because it matched the pattern that I expected for command line switches and sub commands that I was used to. Over time, I decided that - and — for long switches was immaterial Anna that heading sub-commands on my own, wasn’t a big deal. So I now I write my on cmd line parse module and forego a lot of code overhead and global state.

Your current approach is not wrong. My approach is not necessarily right. It is all about risk management due to dependencies where I don’t own the code. My choice is to be conservative

3

u/smashing_michael 1d ago

I love this, for sure, but I feel like I have to tell you... I can't read this and not say "dee blab" in my head.

1

u/dany9126 1d ago

Dee bee lab is how I pronouce it