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

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:

New development is happening on GitHub at:

There is a Google Group for discussion at:

Getting started

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

pip install -U pip
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']))


Recent Changes

Version 2.2.4 - 2022-04-12 - Mikhail Terekhov


  • Added bytes and bytearray to support bulk_copy types, thanks to steve-strickland (#756).

  • Use FreeTDS-1.3.9 for official wheels on PyPi.

  • Enable krb5 in Linux wheels, this time for real (#754).

Download files

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

Source Distribution

pymssql-2.2.5.tar.gz (170.1 kB view hashes)

Uploaded source

Built Distributions

pymssql-2.2.5-cp310-cp310-win_amd64.whl (1.5 MB view hashes)

Uploaded cp310

pymssql-2.2.5-cp310-cp310-win32.whl (1.2 MB view hashes)

Uploaded cp310

pymssql-2.2.5-cp39-cp39-win_amd64.whl (1.5 MB view hashes)

Uploaded cp39

pymssql-2.2.5-cp39-cp39-win32.whl (1.2 MB view hashes)

Uploaded cp39

pymssql-2.2.5-cp38-cp38-win_amd64.whl (1.5 MB view hashes)

Uploaded cp38

pymssql-2.2.5-cp38-cp38-win32.whl (1.2 MB view hashes)

Uploaded cp38

pymssql-2.2.5-cp37-cp37m-win_amd64.whl (1.5 MB view hashes)

Uploaded cp37

pymssql-2.2.5-cp37-cp37m-win32.whl (1.2 MB view hashes)

Uploaded cp37

Supported by

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