logoalt Hacker News

Show HN: Sqlit – A lazygit-style TUI for SQL databases

162 pointsby MaxTeabaglast Monday at 3:47 PM36 commentsview on HN

I work mostly in the terminal but found myself constantly switching to bloated GUIs like SSMS only for the simple task of browsing tables and run queries. And I didn't find Existing SQL TUIs intuitive, having to read documentation to learn keybindings and CLI flags to connect. Given I had recently switched to linux, I found myself using vs code's sql database extension. Something was awfully wrong.

I wanted something like lazygit for databases – run it, connect, and query and frankly just make it enjoyable to access data.

  Sqlit is a keyboard-driven SQL TUI with:

  - Context-based keybindings (always visible)
  - Neovim-like interface with normal and insert mode for query editing
  - Browse databases, tables, views, stored procedures
  - Adapters for SQL Server, SQLite, PostgreSQL, Turso & more
  - SSH tunneling support
  - Themes (Tokyo Night, Nord, Gruvbox etc.)

  Inspired by lazygit, neovim and lazysql. Built with Python/Textual.
Feedback welcome – especially on which adapters to prioritize next. My vision of sqlit is to make a tool that makes it easy to connect and query data, and to do that, and that thing only, really well.

https://github.com/Maxteabag/sqlit


Comments

tracker1today at 5:16 PM

Definitely cool to see... Lost of new TUI applications, but seems to be more than a handful of DB UIs at this point. Was half surprised it wasn't another Rust+Ratatui application. Not that there's anything wrong with that either.

Maybe I'm just a little jaded at seeing a lot of the same type of thing rehashed multiple times a week lately.

This isn't meant to detract from this author, or any other... You have an itch and scratched it. This is what makes open-source work.

tanintoday at 2:06 AM

I've built a similar app but for desktop GUI. The UI is very similar to this app because I like TUI style UI due to the efficient use of UI space.

It focuses more on editing and exploring data for power users. UI space is utilized well. Exploring millions of rows is a breeze. Writing SQLs and managing them is pleasant with the multi-tab approach.

I'm working through adding the shortcuts and modal mode. I want to make it more like vim where you just use shortcuts to do things.

It supports postgres, click house, and sqlite

I'm looking for early beta users. If you are interested in a GUI version, here: https://github.com/tanin47/backdoor

caminanteblancoyesterday at 10:41 PM

This looks awesome! Is there a way to log in some way that doesn't leave your credentials saved in a text file or your bash history? I would use this at work, but I think my sysadmin would eat me alive if I was storing the login credentials in plaintext

show 1 reply
vinshootoday at 12:10 PM

Looks great! It seems that sqlit still relies on arrow keys for getting around. Would it be possible to add options for more vim style on these places?

- Browse explorer tree with jk

- Next/Prev autocomplete suggestion with ^+j,^+k

- Browse Results with hjkl

Some other suggestions:

- Filter tables (f.e. press / and start typing to filter down tables)

- Ability to edit cell value

Otherwise it feels great, thanks for it :) UI looks much nicer than on lazysql and toggleable sidebar is great.

mrbumptoday at 8:30 AM

Congrats, looks fantastic! I have been looking for something like that. Maybe I have missed it, but one feature I would really love is support for temporary connections - e.g. being able to do something like "sqlit --db-type sqlite --file-path db.sqlite3" to quickly inspect a DB without having to set up a connection first.

lgastoday at 12:27 AM

I was surprised to find that I could not run it with uvx:

    % uvx sqlit
       Built unicodecsv==0.14.1
       Built sqlit==0.1.6
    Installed 2 packages in 1ms
    Traceback (most recent call last):
      File "/Users/john/.cache/uv/archive-v0/AP7XgAQ1v0HpPxXUi-hs4/bin/sqlit", line 7, in <module>
        from sqlit.main import main
      File "/Users/john/.cache/uv/archive-v0/AP7XgAQ1v0HpPxXUi-hs4/lib/python3.12/site-packages/sqlit/main.py", line 125
        print sql
        ^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
show 1 reply
no_news_isyesterday at 3:18 AM

Very nice, works well.

It seems you put some menu items behind what I'll call "[space] mode," where you you have to press the spacebar first to open the command menu, then use the command.

This is not reflected properly in the help text shown when you press ? and that was a source of confusion for me.

Especially since I managed to activate the fullscreen mode for one pane AND turn it off, but then couldn't figure out how I did it; and also, I did not find the space-Q option to Quit at first.)

Edit to add, I prefer installing with pipx.

These commands worked for me, to get Postgresql and MariaDB database plugins:

  pipx install sqlit-tui
  cd ~/.local/pipx/venvs/sqlit-tui
  source bin/activate
  bin/python3 -m pip install psycopg2
  sudo apt-get install -y libmariadb-dev  # On Debian
  bin/python3 -m pip install mariadb
I didn't try installing system-wide as per the GitHub instructions, I don't know if that would have worked just as well with pipx or not.
show 2 replies
yoavmyesterday at 8:41 PM

Looks great, congrats! Also check out https://github.com/achristmascarl/rainfrog which seems to have similar goals, though is Postgres only.

show 1 reply
debarshriyesterday at 9:01 PM

One of the feedback i have heard from people using SSMS is that it has all the admin operations available in the UI as compared to doing it yourself. Lot of admins i deal with day to day do not want to use the terminal or sqlcmd.

I'm wondering if thats true.

show 1 reply
ruicraveirotoday at 10:12 AM

There's only one thing I can say about this: THANK YOU!!!!! Really cool!

slimebot80yesterday at 1:45 AM

This looks lovely.... does it support remote D1?

le-markyesterday at 10:48 PM

What tool is used to make the gifs of the ui?

show 2 replies
waterTanukitoday at 5:13 AM

Tried it out on a local test postgres db.

First error: "Connection failed, no module named 'psycopg2'"

show 1 reply
alsetmusicyesterday at 1:36 AM

Very attractive design.

onemoresoopyesterday at 11:14 PM

Looks fantastic.

oulipo2yesterday at 11:31 PM

What would be the main differences with Harlequin?

show 2 replies
bpiromantoday at 1:07 AM

dude, this looks so cool!!!