By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,695 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,695 IT Pros & Developers. It's quick & easy.

your opinion about psycopg vs pygresql

P: n/a
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.

--
mph
Dec 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Martin P. Hellwig wrote:
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
Dec 21 '06 #2

P: n/a
Martin P. Hellwig wrote:
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

Dec 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.