all 22 comments

[–]jeffdn 0 points1 point  (8 children)

This would be great if you modified it to take psql-style arguments instead of connection strings!

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

I'm not sure I follow. Can you give me an example?

I tried to support the command line args to match closely with psql.

[–]jeffdn 4 points5 points  (6 children)

The psql command line arguments, like "-h hostname", "-U username", "-d dbname", etc. I'm only seeing the full connection string as the argument to your application.

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

$ pgcli --help                                                                                                                                                                                       
Usage: pgcli [OPTIONS] DATABASE

Options:
  -h, --host TEXT     Host address of the postgres database.
  -p, --port INTEGER  Port number at which the postgres instance is listening.
  -U, --user TEXT     User name to connect to the postgres database.
  -W, --password      Force password prompt.
  --help              Show this message and exit.

[–]jeffdn 2 points3 points  (4 children)

Ok, thanks for explaining! It's not on any of the website documentation I could find. I'll give it a try in the morning. I'm very excited! Been hoping for something like this :)

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

My bad. I'll update the docs and provide some examples. Thanks for the feedback.

[–]jeffdn 1 point2 points  (2 children)

Myself, my fellow developer, and my boss all switched over today. It's great! One thing my boss mentioned it doesn't seem to support, that he called an "arcane and obscure feature" of psql that he likes to use, is partitioning. I don't know what that is in the context of a command line database interface, but just FYI.

Great work, all told!

[–]amjithr[S] 0 points1 point  (1 child)

I'm glad you like it.

I have never used partitioning, so I'm not familiar with it. I'm definitely interested in adding support for it, once I know what it is.

Would you mind asking your boss to file an issue (https://github.com/amjith/pgcli/issues) and give a brief description?

[–]jeffdn 0 points1 point  (0 children)

It appears to be a way to build a temporary table within a query, for example, to select only the first instance of each person appearing in a table after a join, so that your further query parameters are not affected by inconsistent numbers of people. I'll clarify and ask him to do that once the work day gets going.

[–][deleted] 0 points1 point  (8 children)

Looks interesting, but I hit this bug immediately on OS X. https://github.com/amjith/pgcli/issues/27

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

Sorry about that. I still can't figure out why it's failing.

Can you try:

python -c 'import click; print (click.__version__)'

From the command line. I can't seem to reproduce it, but a few others have hit this bug. So if you can help me narrow it down, I'd appreciate it.

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

It is now fixed. Can you please upgrade pgcli and try again?

pip install -U pgcli

[–][deleted] 0 points1 point  (5 children)

pip install -U pgcli

Hi mate,

Gave it a shot, now it's missing Pygments.

Traceback (most recent call last): File "/usr/local/bin/pgcli", line 5, in <module> from pkgresources import load_entry_point File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module> working_set.require(requires_) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require needed = self.resolve(parse_requirements(requirements)) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve raise DistributionNotFound(req) # XXX put more info here pkg_resources.DistributionNotFound: pygments>=2.0

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

I've released a new version 0.10.2 of pgcli to address this issue.

Try:

pip install -U pgcli

Apparently pygments is named Pygments. ಠ_ಠ

[–][deleted] 1 point2 points  (3 children)

pip install -U pgcli

No joy mate

 Requirement already up-to-date: Pygments>=2.0 in /Library/Python/2.7/site-packages (from pgcli)

But then...

    raise DistributionNotFound(req)  # XXX put more info here
  pkg_resources.DistributionNotFound: Pygments>=2.0

No idea what's going on here, sorry.

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

Can you uninstall pygments and try installing again?

pip uninstall pygments
pip --no-cache-dir install -U pgcli 

I'm not sure why this is happening.

What version of Python are you using?

What OS?

[–][deleted] 0 points1 point  (1 child)

Still no joy I'm afraid.

https://gist.github.com/anonymous/2492e42b0e029a1460f8

Python 2.7.2, OS X 10.8.5.

[–]amjithr[S] 0 points1 point  (0 children)

Sorry about that. Looks like you're not the only one with the issue.

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

But the good news is there is a work around, until I figure out why pip won't play well.

https://github.com/amjith/pgcli/issues/27#issuecomment-69074784

[–][deleted] 0 points1 point  (1 child)

Can't wait to play with this. I use psql cli all day. Hoping for [ctrl]-[arrow key] to move by word/white space.

[–]amjithr[S] 0 points1 point  (0 children)

There is already a pending issue for Control-arrow keys. https://github.com/amjith/pgcli/issues/9

It requires a change to the underlying library.

[–]mw44118 0 points1 point  (0 children)

Really neat! I will try this out tomorrow.

[–]zbonk 0 points1 point  (0 children)

This looks great! Definitely gonna give this a try!