views:

47

answers:

1

We are in the process of upgrading from PostgreSQL 8.3 to PostgreSQL 8.4, in a large part so that we can start using certificate-based authentication.

We have some Python 2.x code that accesses the database that uses PyGreSQL. Is there a way to get it or any other Python library to use a cert to access PostgreSQL?

Looking through the PyGreSQL source, I didn't see a way to supply a certificate.

+2  A: 

psycopg2 is based on libpq, so it should work there. I don't think there's a specific interface for it, so you'll have to use the environment variables (see the libpq documentation) to control it, but it should work. (disclaimer: I haven't actually tried it, but anything on top of libpq should work)

Magnus Hagander
Looks like PyGreSQL is based on libpq as well, and sure enough works fine if I put the certificates in the default locations and pass no username nor password.
CoverosGene
For the record, psycopg2 worked the same way as well.
CoverosGene