DB-API interface to Microsoft SQL Server for Python. (new Cython-based version)
Project Links
Meta
Author: Damien Churchill
Maintainer: Mikhail Terekhov
Requires Python: >=3.9
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
Programming Language
- Python
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
- Python :: Implementation :: CPython
Topic
- Database
- Database :: Database Engines/Servers
- Software Development :: Libraries :: Python Modules
Operating System
- Microsoft :: Windows
- POSIX
- Unix
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']))
conn.close()
Recent Changes
Version 2.3.8 - 2025-10-11 - Mikhail Terekhov
General
Build Python 3.14 wheels, thanks to Edgar Ramírez Mondragón (PR #964).
Version 2.3.7 - 2025-07-10 - Mikhail Terekhov
General
Allow to specify openssl dependency on macos, thanks to dwt (PR #934).
Oct 12, 2025
2.3.8
Jul 11, 2025
2.3.7
Jun 28, 2025
2.3.6
Jun 25, 2025
2.3.5
Apr 02, 2025
2.3.4
Apr 01, 2025
2.3.3
Nov 21, 2024
2.3.2
Aug 25, 2024
2.3.1
Apr 06, 2024
2.3.0
Dec 04, 2023
2.2.11
Oct 26, 2023
2.2.10
Oct 14, 2023
2.2.9
Jul 30, 2023
2.2.8
Nov 16, 2022
2.2.7
Nov 13, 2022
2.2.6
Apr 13, 2022
2.2.5
Jan 24, 2022
2.2.4
Dec 21, 2021
2.2.3
Jul 24, 2021
2.2.2
Apr 16, 2021
2.2.1
Apr 06, 2021
2.2.1.dev0
Apr 09, 2021
2.2.0
Sep 17, 2020
2.1.5
Aug 28, 2018
2.1.4
Aug 14, 2018
2.1.4rc1
Jun 22, 2016
2.1.3
Feb 10, 2016
2.1.2
Nov 25, 2014
2.1.1
Feb 26, 2014
2.1.0
Oct 27, 2013
2.0.1
Oct 25, 2013
2.0.0
Oct 11, 2013
1.0.3
Apr 28, 2009
1.0.2
Feb 05, 2009
1.0.1
Jan 30, 2009
1.0.0
Nov 25, 2014
2.1.1.win32
Nov 25, 2014
2.1.1.win
Feb 28, 2014
2.1.0.win32
Oct 28, 2013
2.0.1.win32
Oct 26, 2013
2.0.0.win32
Apr 28, 2009
1.0.2.win32
Feb 05, 2009
1.0.1.win32
Jan 30, 2009
1.0.0.win32
Wheel compatibility matrix
Files in release
No dependencies