SQL Server,Python和OS X [英] SQL Server, Python, and OS X

查看:108
本文介绍了SQL Server,Python和OS X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将OS X上运行的Python与基于云的SQL Server数据库接口的一种好方法是什么?

What's a good way to interface Python running on OS X with a cloud-based SQL Server database?

使用pyodbc时出现此错误:

With pyodbc I'm getting this error:

>>> import pyodbc
>>> cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=adsf.com;DATABASE=asdf;UID=asdf;PWD=asdf')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyodbc.Error: ('00000', '[00000] [iODBC][Driver Manager]dlopen({SQL Server}, 6): image not found (0) (SQLDriverConnect)')

推荐答案

SQLAlchemy 可能是您最好的选择.它具有ORM,但不需要使用.许多DBAPI项目都支持MS SQL.

SQLAlchemy is probably your best bet. It has an ORM, but doesn't require its use. MS SQL is supported through a number of DBAPI projects.

对于低级接口,下面是SQLAlchemy站点上列出的三个具有原始Python和Unix支持的DBAPI项目:

As for lower-level interfaces, here's the three DBAPI projects listed at SQLAlchemy's site that have vanilla Python and Unix support:

  • pymssql 似乎是最简单的设置;它不需要FreeTDS.
  • pyodbc 似乎比pymssql更加活跃.
  • mxODBC 是许多数据库的商业许可接口.
  • pymssql appears to be the simplest to set up; it doesn't require FreeTDS.
  • pyodbc appears to be under more active development than pymssql.
  • mxODBC is a commercially-licensed interface to many databases.

这篇关于SQL Server,Python和OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆