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?
-
For what it's worth, django uses psycopg2.
maxp : There are two psql drivers in Django, the most popular is psycopg2 but what about second? Is it pygresql driver? -
psycopg2 is what most people go with.
-
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.
iny : PyGreSQL has C module too. -
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).
-
"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.
-
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
0 comments:
Post a Comment