Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Commandline Database Clients with Autocompletion and Syntax Highlighting (dbcli.com)
99 points by thunderbong on Feb 18, 2021 | hide | past | favorite | 22 comments


I've been really happily using pgcli for the last couple years. I really like it. It has all of the upside of psql but with added benefits that don't get in the way and are configurable. If you use psql, I believe it's pretty much a drop-in replacement and worth the minimal effort to try out. I personally switched from a GUI client, since I had been missing the psql backslash commands for a while


I use psql for quick exploration and simple queries. Just installed pgcli through brew but it blew up trying to use the services defined in .pg_service. Maybe I need to set an alias to a connection string. Not exactly a drop-in though.

This does look very promising so thanks for the suggestion.


In what way did it blow up? You must have hit a bug, using .pg_service should work. Would you care to open an issue on https://github.com/dbcli/pgcli/issues or just dump the error message here so we can investigate?


  mulmen@hostname ~> pgcli service=mulmen@db
  Traceback (most recent call last):
  File "/usr/local/bin/pgcli", line 33, in <module>
    sys.exit(load_entry_point('pgcli==3.1.0', 'console_scripts', 'pgcli')())
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, \*kwargs)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, \*ctx.params)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, \*kwargs)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/pgcli/main.py", line 1311, in cli
    pgcli.connect_service(service, user)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/pgcli/main.py", line 479, in connect_service
    service_config, file = parse_service_info(service)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/pgcli/main.py", line 1508, in parse_service_info
    service_file_config = ConfigObj(service_file)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/configobj.py", line 1229, in __init__
    self._load(infile, configspec)
  File "/usr/local/Cellar/pgcli/3.1.0/libexec/lib/python3.9/site-packages/configobj.py", line 1318, in _load
    raise error
  configobj.ParseError: Invalid line ('PG Service File for saved connection parameters') (matched as neither section nor keyword) at line 1.
Looks like it blew up on a comment line at the top of the file. For some reason the file did not have a # before the comment but psql happily ignores that. I added a # and pgcli loads properly.


Nice to hear that it works! I can reproduce it, psql does seem to handle arbitrary text before the first section of .pg_service.conf. Weird. We'll add a workaround as well.


I'm curious how I ended up with that line there actually. Maybe it was a copy-paste that missed a character? Maybe it was an example I grabbed somewhere? I searched but the only occurrence of that string on the indexed web seems to be my own comment. So maybe I did this to myself.


One thing I always miss from CLI is the vertical properties view: `\G` in mysql and `\x` in pgsql


They are both supported in mycli and pgcli clients.



These are quite nice. I'd like to complain however that the pgcli on PyPi is out of date and a newer version that has several new features implemented should be pushed forward. :D


The latest version of pgcli is pypi was released on Dec 11 2020. There are only a few changes unreleased in the master branch.

https://github.com/dbcli/pgcli/blob/master/changelog.rst

What feature are you waiting for? I can talk to the project lead to see if we can push out a new release if needed.


A pypi release with improved warnings for destructive queries may be good.

BTW thanks for pgcli. It's helped me a lot lately.


Oh thanks. They aren't critical but I was waiting on the unicode table borders without row separators and ability to change additional syntax highlight colors in the config file.

Also, I have some awkward issues when typing out statements and don't know if they have been improved. Was just hoping maybe there had been some tweaks in the area have no information on that.


Azure Data Studio is a very nice hybrid between a lightweight visual and a rich command line tool. It still has some bugs but I like it very much (and it's cross platform).


Azure Data Studio is slick, but disappointingly it's not open source. (It's source available with a proprietary license).

BeeKeeper Studio has hence caught my attention.

There are is also an open source database extensions for VSCode, including an official MSSQL one from Microsoft. Except, I just realised many of its key dependencies are proprietary.


I can imagine a use for this when looking for a quick answer without having to wait for SQL Server Management Studio to load up.


I'm not a heavy db user, but I touch it once or twice a day. I use mycli as my daily driver. I configured separate profiles for when I connect to prod, and added autocomplete for my db profiles.

I haven't found a gui I'm happy with on Linux, but I've been loving mycli for the last 4 years or so.


> I've been loving mycli for the last 4 years or so.

So rewarding to hear this. Cheers!


From the "About" page :)

> We prioritize being nice more than being right.


I had a chance to meet some of the devs on the project at a hackathon after pycon a few years ago.

That statement perfectly describes my experience. Really friendly and welcoming group.


Has anyone found/built a CLI client for DynamoDB?


AWS CLI is pretty handy




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: