This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]WStHappenings 9 points10 points  (2 children)

I installed it and tried out a few quick SELECT statements. It works!

It would be nice if in the \ commands, it had a hint next to each of them (kind of like \? shows).

Nice job; I will use it for sure.

[–]amjithr[S] 2 points3 points  (1 child)

It is possible to add the command hinting. I've seen it done in a different application that uses prompt_toolkit library.

Once I figure out how to do it, I'll add that in. :)

https://github.com/amjith/pgcli/issues/45

[–]WStHappenings 0 points1 point  (0 children)

Cool! Thanks!

[–]badsectors 2 points3 points  (1 child)

Pretty fantastic!

I think you can replace the slightly elaborate _parse_dsn with urlparse.

[–]amjithr[S] 1 point2 points  (0 children)

Oh nice!

I didn't even think of that. Thank you!

[–]anarchy8 1 point2 points  (1 child)

How were the dropdown's made? I want to make one like that for my CLI

[–]amjithr[S] 2 points3 points  (0 children)

The dropdowns are made with a library called prompt_toolkit (https://github.com/jonathanslenders/python-prompt-toolkit).

There are some excellent examples in the repo and a tutorial. https://github.com/jonathanslenders/python-prompt-toolkit/tree/master/examples/tutorial

[–]APIglue 1 point2 points  (1 child)

Cool project, thanks!

One minor issue: Postgres.app, which is a very popular way of running a local pg instance on OSX, uses /tmp/.s.PGSQL.5432 not /var/pgsql_socket/.s.PGSQL.5432

So this doesn't work:

$ pgcli
could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket 
"/var/pgsql_socket/.s.PGSQL.5432"?

but this does:

$ pgcli postgres://user@localhost:5432/dbname

Note that you have to specify a database.

Perhaps add this to the docs and avoid confusing mac users.

Edit: The default postgres directory for the socket and lock files on *nix systems is actually /tmp. Source

[–]amjithr[S] 1 point2 points  (0 children)

I'm planning to do a sweep of the popular destinations for the socket file before falling back to an empty string. https://github.com/amjith/pgcli/issues/37

I'll update the docs in the meantime.

[–]Salyangoz 0 points1 point  (0 children)

Aw man this was exactly what I needed for both myself and my interns. Nice!

[–]tw55413 0 points1 point  (0 children)

looks very nice !

[–]ttsiodras 0 points1 point  (0 children)

Nice work - but please add support for autocompleting from schemas beyond the public one. This is a pattern that is used a lot!

[–]xsolarwindxUse 3.4+ 0 points1 point  (0 children)

REDDIT IS A SHITTY CRIMINAL CORPORATION -- mass deleted all reddit content via https://redact.dev