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 -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']))

conn.close()

Recent Changes

Version 2.2.11 - 2023-12-03 - Mikhail Terekhov

General

  • Use FreeTDS-1.4.9 for official wheels on PyPi.

  • Add workflow for aarch64 wheel. Thanks to juntangc (fix #692, #759, #791, #819, #826, #858).

  • Add datetime.date to SQLDATE conversion.

  • Add encription parameter to connect (fix #797).

Bug fixes

  • Fix version parsing in development.

  • Add missing charset parameter when formatting query (fix #650).

  • Use four digits for the year in SP args binding (fix #454).

  • Fix convert_python_value to work with datetime.date (fix #811).

Version 2.2.10 - 2023-10-20 - Mikhail Terekhov

General

  • Publish Linux wheels for Python-3.12

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.11.tar.gz (172.4 kB view hashes)

Uploaded source

Built Distributions

pymssql-2.2.11-cp312-cp312-win_amd64.whl (2.0 MB view hashes)

Uploaded cp312

pymssql-2.2.11-cp312-cp312-win32.whl (1.3 MB view hashes)

Uploaded cp312

pymssql-2.2.11-cp311-cp311-win_amd64.whl (2.0 MB view hashes)

Uploaded cp311

pymssql-2.2.11-cp311-cp311-win32.whl (1.3 MB view hashes)

Uploaded cp311

pymssql-2.2.11-cp310-cp310-win_amd64.whl (2.0 MB view hashes)

Uploaded cp310

pymssql-2.2.11-cp310-cp310-win32.whl (1.3 MB view hashes)

Uploaded cp310

pymssql-2.2.11-cp39-cp39-win_amd64.whl (2.0 MB view hashes)

Uploaded cp39

pymssql-2.2.11-cp39-cp39-win32.whl (1.3 MB view hashes)

Uploaded cp39

pymssql-2.2.11-cp38-cp38-win_amd64.whl (2.0 MB view hashes)

Uploaded cp38

pymssql-2.2.11-cp38-cp38-win32.whl (1.3 MB view hashes)

Uploaded cp38

pymssql-2.2.11-cp37-cp37m-win_amd64.whl (2.0 MB view hashes)

Uploaded cp37

pymssql-2.2.11-cp37-cp37m-win32.whl (1.3 MB view hashes)

Uploaded cp37

pymssql-2.2.11-cp36-cp36m-win_amd64.whl (2.0 MB view hashes)

Uploaded cp36

pymssql-2.2.11-cp36-cp36m-win32.whl (1.3 MB view hashes)

Uploaded cp36

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page