蟒蛇&sql服务器 [英] Python & sql server

查看:42
本文介绍了蟒蛇&sql服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 python 访问 sql server 的最佳方式是 DB-API 吗?也有人可以使用 DB-API 提供这样的代码,如何从 python 连接到 sql server 并执行查询?

What is the best way to access sql server from python is it DB-API ? Also could someone provide a such code using the DB-API how to connect to sql server from python and excute query ?

推荐答案

参见 pyodbc -Python 数据库 API 规范 v2.0 实现.效果很好.

See pyodbc - Python Database API Specification v2.0 implementation. Works great.

此外,您可以将其与其他数据库一起使用.如果与 SQL Server 2008 一起使用,如果需要支持新的 DATE 数据类型,请确保使用本机驱动程序.

Additionally you can use it with other databases. If using with SQL Server 2008, make sure you use Native Driver if you need to support new DATE data types.

这篇关于蟒蛇&sql服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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