views:

1142

answers:

6

What is the difference between these two apis? Which one faster, reliable using Python DB API?

Upd: I see two psql drivers for Django. The first one is psycopg2. What is the second one? pygresql?

+1  A: 

For what it's worth, django uses psycopg2.

There are two psql drivers in Django, the most popular is psycopg2 but what about second? Is it pygresql driver?
maxp
A: 

psycopg2 is what most people go with.

Jeremy Cantrell
A: 

psycopg2 is partly written in C so you can expect a performance gain, but on the other hand, a bit harder to install. PyGreSQL is written in Python only, easy to deployed but slower.

Sebastjan Trepča
PyGreSQL has C module too.
iny
+2  A: 

Licensing may be an issue for you. PyGreSQL is MIT license. Psycopg2 is GPL license.

(as long as you are accessing psycopg2 in normal ways from Python, with no internal API, and no direct C calls, this shouldn't cause you any headaches, and you can release your code under whatever license you like - but I am not a lawyer).

Ali A
A: 

"PyGreSQL is written in Python only, easy to deployed but slower."

PyGreSQL contains a C-coded module, too. I haven't done speed tests, but they're not likely to be much different, as the real work will happen inside the database server.

A: 

Psycopg2 doesn't have much documentation but the code in the examples directory is very helpful.
Also it's thread safety level 2, meaning multiple threads can share the module and connections but not the cursors.
python dbi pep

thethinman