We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
您已经建议了 pyodbc,我同意您的观点。
在我的经验中,它给我带来的问题最少; 我使用过 pymssql 和 adodbapi,当这些抛出异常/创建问题时,我交换了代码并将其替换为 pyodbc,它要么解决了问题,要么提供了更好的错误消息,以便我可以更快地调试。
值得一提的是,我主要用它来连接MSSQL Server数据库。
You already suggested pyodbc, and I am going to agree with you.
It has given me the least amount of issues in my experience; I've used pymssql and adodbapi, and when those threw exceptions/created issues, I swapped out the code and replaced it with pyodbc and it either fixed the problem, or gave better error messages so I could debug faster.
It's worth mentioning that I primarily use it to connect to MSSQL Server DBs.
我使用 SQLAlchemy 进行所有 python 数据库访问。 我强烈推荐 SQLAlchemy。
连接到 SQL Server 数据库时,SA 在底层使用 pyodbc。 它使用其他 DBAPI 库连接到其他数据库,例如 cx_Oracle。
一个简单的例子,像通常使用 DBAPI 模块一样使用 SQLAlchemy:
但是 SQLAlchemy 的真正价值在于它的 ORM 和 SQL 表达式语言。 看看吧,非常值得花功夫去学习使用。
I use SQLAlchemy for all python database access. I highly recommend SQLAlchemy.
SA uses pyodbc under the hood when connecting to SQL server databases. It uses other DBAPI libraries to connect to other database, for instance cx_Oracle.
A simplistic example, using SQLAlchemy like you would normally use a DBAPI module:
But the real value of SQLAlchemy lies in its ORM and SQL expression language. Have a look, it is well worth the effort to learn to use.
另一种选择是 pypyodbc ,它是用纯 Python 编写的。 它可以看作是pyodbc模块的重新实现——只有大约1800行代码,有利于维护。
这是在Python中访问mssql的Hello World示例。
Another alternative is pypyodbc which was written in pure Python. it can been seen as a re-implemenation of the pyodbc module – with only around 1800 lines code, which is good for maintenance.
Here's a Hello World sample of accessing mssql in Python.
我在工作中使用 pyodbc,它从来没有让我失望过(我们有各种数据库)。 它坚固且快速。
它得到积极维护,并且 python 3 版本即将推出。
如果您想要具有付费支持的“企业”软件,您可以使用 mxODBC。
I use pyodbc at work and it has never failed me (we have varius dbs). It is robust and fast.
It is actively maintained and a python 3 version will come soon.
If you want "enterprise" software with payed support you can use mxODBC.
您可以尝试一下 turbodbc。 从1.1.1版本开始,正式支持Windows。 对于您所做的事情来说,它很有可能比 pyodbc 更快。
You can give turbodbc a spin. Since version 1.1.1, it officially supports Windows. There's a good chance that it is faster than pyodbc for what you do.
pyodbc 现在支持 Python 3!
Python 3 is now supported by pyodbc!