This project is archived and is in readonly mode.
[Feature Request] Add support for a pgpass connect parameter
-
Daniele Varrazzo
- State changed from new to invalid
I actually don't see the pgpass parameter listed here: http://www.postgresql.org/docs/9.1/static/libpq-connect.html If it is not documented anywhere I don't think we should add it: it may be an implementation detail. Do you have further info?
I see at least two different way to work around the issue:
- write your own wrapper around
psycopg2.connect()taking an arbitrary list of keywords and converting them into a connection string, and tell your ORM to use it (or monkeypatch thepsycopg2module if it doesn't) - use the
PGPASSFILEenv var that I see used insrc/interfaces/libpq/fe-connect.c: it seems doing what you need
I'm not eager to add all the dozens keywords the libpq supports: passing a connection string seems a good enough solution. You may open a discussion to the mailing list if you think the feature is really useful and check what the other think.
-
Joshua D. Drake
This is in no way an invalid ticket. The use of PGPASS is quite documented:
http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html
And it is the standard way to use stored password and connection string options. This is something that should definitely be added. In fact I thought it already worked (because all my other programs can use it) until I started updating PITRTools which is written in Python.
-
Joshua D. Drake
And now I see that I was cracked and didn't read your ticket properly. Sorry about that Daniele. I know understand what you mean there and that does make sense.
-
Daniele Varrazzo
- State changed from invalid to resolved
By the way sometimes after this ticket was closed we have added libpq arguments pass-through (see http://initd.org/psycopg/docs/module.html#psycopg2.connect) so, even if not specifically dealt with, psycopg now does what requested in this ticket (provided that the libpq can handle the 'pgpass' argument in the conninfo string, as it seems the case).