I was wondering what are the most popular open source obdc/database connection libraries are.
I've heard of pyodbc, but I wasn't sure how widely used it was.
Thanks
I was wondering what are the most popular open source obdc/database connection libraries are.
I've heard of pyodbc, but I wasn't sure how widely used it was.
Thanks
http://wiki.python.org/moin/ODBC details some of the ODBC solutions for Python. pyodbc seems to be your best option for a few reasons:
Sadly, I have no way of providing you much further information because Google Code is down, and that's where pyodbc is hosted (along with many others). It seems to be the closest to a standard solution, however.
Google Code is back up and it seems to me from the project site that pyodbc is very actively contributed to and maintained, and it seems to be keeping up with Python, as a 3.x port is coming soon.
If you use Windows, then in popular Active State distribution you will find odbc
module. I think it is part of pywin32 package. Of course pyodbc will be better if you do not use MS Windows. All you have to do is:
import odbc
connection = odbc.odbc('dsnname/user/passwd')
While pydobc connect string looks different you can made your program work with both libraries:
if '/' in connect_string:
import odbc
# dsnname/user/password
_CONN = odbc.odbc(connect_string)
elif connect_string.startswith('Driver='):
import pyodbc
# Driver={PostgreSQL};Server=db-test;Port=5435;Database=dbname;Uid=user;Pwd=password;
_CONN = pyodbc.connect(connect_string)