your opinion about psycopg vs pygresql

M

Martin P. Hellwig

Hi all,

I'm playing a bit with PostgreSQL, in which I've set me the target to
create a python script which with user input creates a new user role and
a database with that owner (connecting to template1 since I know that at
least that db exists).

Ok so I installed PostGreSQL and pygresql since it looked like that this
is endorsed by PG, I had some trouble with the DB-API2 (complains about
there is already a connection to template1, even when I closed and
deleted the connector) so I solved it by using the pg api.

But I was intrigued by this problem and started googling and by that
time I've noticed that python projects like Django seem to favor the
psycopg module.

So I installed that one (the 1.1 version, since Django uses that too)
and it looked like it has the same problem of creating a user after a
database, I'm sure that there is a user error in there somewhere :)

However, given the choice, what in your opinion would be the reason why
someone would chose one over the other? Now I know this could easily get
into a flamewar, so if you comment (but please do so) I'll still
investigate that, since at this moment I don't even have a clue how they
differ and on what reason, why does PostgreSQL seem to favour pygresql
and Pythoneers psycopg?

Thanks in advance.
 
J

johnf

Martin said:
Hi all,

I'm playing a bit with PostgreSQL, in which I've set me the target to
create a python script which with user input creates a new user role and
a database with that owner (connecting to template1 since I know that at
least that db exists).

Ok so I installed PostGreSQL and pygresql since it looked like that this
is endorsed by PG, I had some trouble with the DB-API2 (complains about
there is already a connection to template1, even when I closed and
deleted the connector) so I solved it by using the pg api.

But I was intrigued by this problem and started googling and by that
time I've noticed that python projects like Django seem to favor the
psycopg module.

So I installed that one (the 1.1 version, since Django uses that too)
and it looked like it has the same problem of creating a user after a
database, I'm sure that there is a user error in there somewhere :)

However, given the choice, what in your opinion would be the reason why
someone would chose one over the other? Now I know this could easily get
into a flamewar, so if you comment (but please do so) I'll still
investigate that, since at this moment I don't even have a clue how they
differ and on what reason, why does PostgreSQL seem to favour pygresql
and Pythoneers psycopg?

Thanks in advance.
I have not used pygresql but I see it often as a standard package with the
SUSE DISTRO. But I use Psycopg 2. I find that it is very fast and provides
a few extentions that I have used. Reported bugs are fixed immediately.

John
 
M

Maxim Sloyko

Martin said:
However, given the choice, what in your opinion would be the reason why
someone would chose one over the other? Now I know this could easily get
into a flamewar, so if you comment (but please do so) I'll still
investigate that, since at this moment I don't even have a clue how they
differ and on what reason, why does PostgreSQL seem to favour pygresql
and Pythoneers psycopg?

Thanks in advance.

Well, my info can be a little out of date, since I researched this
problem more than a year ago.
AFAIK, psycopg still lacks prepared statements, which can be a huge
drawback (partial workaround: use executemany() whenever possible).
Psycopg 2 (as opposed to psycopg 1.1) does not support commit() on
cursor (no serialized connections)

Among the advantages of psycopg 2 is its very good support of mappings
between Python data types and PostgreSQL data types. You can easily
introduce your own mappings, even for composite data types.

My $0.02
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top