Skip to main content

DB-API interface to Microsoft SQL Server for Python. (new Cython-based version)

Project description

pymssql - DB-API interface to Microsoft SQL Server

https://github.com/pymssql/pymssql/workflows/Linux/badge.svg https://github.com/pymssql/pymssql/workflows/macOS/badge.svg https://github.com/pymssql/pymssql/workflows/Windows/badge.svg http://img.shields.io/pypi/dm/pymssql.svg http://img.shields.io/pypi/v/pymssql.svg

A simple database interface for Python that builds on top of FreeTDS to provide a Python DB-API (PEP-249) interface to Microsoft SQL Server.

Detailed information on pymssql is available on the website:

pymssql.readthedocs.io

New development is happening on GitHub at:

github.com/pymssql/pymssql

There is a Google Group for discussion at:

groups.google.com

Getting started

pymssql wheels are available from PyPi. To install it run:

pip install pymssql

Most of the times this should be all what’s needed. The official pymssql wheels bundle a static copy of FreeTDS and have SSL support so they can be used to connect to Azure.

Basic example

conn = pymssql.connect(server, user, password, "tempdb")
cursor = conn.cursor(as_dict=True)

cursor.execute('SELECT * FROM persons WHERE salesrep=%s', 'John Doe')
for row in cursor:
    print("ID=%d, Name=%s" % (row['id'], row['name']))

conn.close()

Recent Changes

Version 2.2.0 - 2021-04-08 - Mikhail Terekhov

General

  • Add Python-3.9 to the build and test matrix.
  • Drop support for Python2 and Python3 < 3.6.
  • Use FreeTDS-1.2.18 for official wheels on PyPi.

Features

  • Support bulk copy (#279). Thanks to Simon.StJG (PR-689).
  • Wheels on PyPI link FreeTDS statically.
  • Wheels on PyPI linked against OpenSSL.
  • Convert pymssql to a package. Potential compatibility issue: projects using low level _mssql module need to import it from pymssql first.

Bug fixes

  • Fixed a deadlock caused by a missing release of GIL (#540), thanks to filip.stefanak (PR-541) and Juraj Bubniak (PR-683).
  • Prevents memory leak on login failure. Thanks to caogtaa and Simon.StJG (PR-690).
  • Fix check for TDS version (#652 and #669).
  • Documentation fixes. Thanks to Simon Biggs, Shane Kimble, Simon.StJG and Dale Evans.

Internals

  • Introduce script dev/build.py to build FreeTDS and pymssql wheels.
  • Simplify setup.py, introduce environment variables to select FreeTDS includes and libraries.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pymssql, version 2.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pymssql-2.2.0-cp36-cp36m-manylinux1_i686.whl (2.5 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pymssql-2.2.0-cp36-cp36m-manylinux1_x86_64.whl (2.6 MB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size pymssql-2.2.0-cp37-cp37m-macosx_10_14_x86_64.whl (506.6 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymssql-2.2.0-cp37-cp37m-manylinux1_i686.whl (2.5 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymssql-2.2.0-cp37-cp37m-manylinux1_x86_64.whl (2.6 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymssql-2.2.0-cp37-cp37m-win32.whl (1.3 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymssql-2.2.0-cp37-cp37m-win_amd64.whl (1.5 MB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size pymssql-2.2.0-cp38-cp38-macosx_10_14_x86_64.whl (513.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymssql-2.2.0-cp38-cp38-manylinux1_i686.whl (2.6 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymssql-2.2.0-cp38-cp38-manylinux1_x86_64.whl (2.7 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymssql-2.2.0-cp38-cp38-win32.whl (1.3 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymssql-2.2.0-cp38-cp38-win_amd64.whl (1.5 MB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size pymssql-2.2.0-cp39-cp39-macosx_10_14_x86_64.whl (516.0 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymssql-2.2.0-cp39-cp39-manylinux1_i686.whl (2.5 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymssql-2.2.0-cp39-cp39-manylinux1_x86_64.whl (2.6 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymssql-2.2.0-cp39-cp39-win32.whl (1.3 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymssql-2.2.0-cp39-cp39-win_amd64.whl (1.5 MB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size pymssql-2.2.0.tar.gz (170.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page