[Tutor] Python Database Scripting

Alan Gauld alan.gauld at btinternet.com
Wed Feb 8 20:10:44 CET 2012


On 08/02/12 18:03, Brad Hudson wrote:
> Can someone provide information on the best modules/python tools to use
> for general database scripting? I'm interested in something that works
> across the board for Oracle, MySQL, MS SQL Server, and DB2. I was hoping
> a good generic ODBC module would be out there, but I'm having difficulty
> locating one that works for all.

There are a few object-database wrappers such as SQLAlchemy that has 
been mentioned.

But be aware that any such generic database wrapper will have 
compromises in performance/scalability. Every database has its own 
foibles and if you need power access you will need to use native access. 
The Python DBAPI is pretty standard but it also allows you to access the 
database features too.

There is an ODBC wrapper too but of course ODBC adds yet another layer 
of limitations. Given the choice of using ODBC via Python DBAPI or using 
Sqlalchemy I'd probably go with SqlAlchemy.

Either approach is valid, it just depends on whether 
performance/flexibility or compatibility/transparency matters
most. You have to pick your poison.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list