Python 跨平台连接 SQL Server


使用 python 访问 SQL Server 数据库,还需要支持跨平台。关于 SQL Server 的吐槽就免了,既然存在,总会有遇到这个问题的时候。

首先在 SQLAlchemy 文档中介绍的连接 SQL Server 的库就是这些了:

  • PyODBC
  • mxODBC
  • pymssql
  • zxJDBC for Jython
  • adodbapi

使用 FitNesse 测试 SQL Server 数据库



FitNesse is a web server, a wiki and an automated testing tool for software. It is based on Ward Cunningham’s Framework for Integrated Test and is designed to support acceptance testing rather than unit testing in that it facilitates detailed readable description of system function.

FitNesse allows users of a developed system to enter specially formatted input (its format is accessible to non-programmers). This input is interpreted and tests are created automatically. These tests are then executed by the system and output is returned to the user. The advantage of this approach is very fast feedback from users. The developer of the system to be tested needs to provide some support (classes named “fixtures”, conforming to certain conventions).

FitNesse is written in Java (by Robert C. Martin and others). The program first supported only Java, but versions for several other languages have been added over time (C++, Python, Ruby, Delphi, C#, etc.).


SQL Server 跨服务器查询实例

First:启用Ad Hoc Distributed Queries,考虑到安全问题非必要保持开启,在使用后可以关闭。

exec sp_configure 'show advanced options',1
exec sp_configure 'Ad Hoc Distributed Queries',1


SELECT * FROM OPENDATASOURCE('SQLOLEDB', 'Data Source=,9000;User ID=sa;Password=123').database.ower.table





  简单恢复模式一般适合用于测试或开发数据库。但是,对于生产数据库,最佳选择通常是完整恢复模式,还可> 以选择大容量日志恢复模式作为补充。但简单恢复模式有时也适合小型生产数据库(尤其是当其大部分或完全为> 只读时)或数据仓库使用。