开发者

Using Mysql and sql server from python

I need to write a python application with use both of the mysql and sql server is there a general python module or l开发者_C百科ibrary that can access both mysql and sql server as DBI with perl or should i use 2 libraries and if yes which libraries do you recommend .


I guess you are looking for SQLAlchemy. You will probably need some time getting into it, but it is invaluable once you have covered the basics.

SQLAlchemy acts as a frontend to other, database-specific libraries using the Python DB-API -- but beyond this, it provides a query builder library that abstracts out differences between databases' SQL syntax and permits programmatic query construction while still offering the full power of SQL.


Python RDBMS modules implement DB-API.


If you are looking for which connection drivers to use, I believe the only one that well work for both [MySQL (driver here) and SQLServer (native to windows/FreeTDS for linux) is pyodbc. @igor has the right idea, though, use SQLAlchemy, you can connect to each database using different engines, but use the same code to interact with both.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜