pymssql
DB-API interface to Microsoft SQL Server for Python. (new Cython-based version)
Install
pymssql on PyPI
pip
pip install pymssqluv
uv add pymssqlpoetry
poetry add pymssqlPackage facts
| License | GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted… (full text in the JSON record) (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 180 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: pymssql-2.3.13-cp310-cp310-macosx_14_0_arm64.whl; pymssql-2.3.13-cp310-cp310-macosx_15_0_x86_64.whl; pymssql-2.3.13-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pymssql-2.3.13-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymssql-2.3.13-cp310-cp310-musllinux_1_2_aarch64.whl; pymssql-2.3.13-cp310-cp310-musllinux_1_2_x86_64.whl; pymssql-2.3.13-cp310-cp310-win_amd64.whl; pymssql-2.3.13-cp311-cp311-macosx_14_0_arm64.whl; pymssql-2.3.13-cp311-cp311-macosx_15_0_x86_64.whl; pymssql-2.3.13-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pymssql-2.3.13-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymssql-2.3.13-cp311-cp311-musllinux_1_2_aarch64.whl; pymssql-2.3.13-cp311-cp311-musllinux_1_2_x86_64.whl; pymssql-2.3.13-cp311-cp311-win_amd64.whl; pymssql-2.3.13-cp312-cp312-macosx_14_0_arm64.whl; pymssql-2.3.13-cp312-cp312-macosx_15_0_x86_64.whl; pymssql-2.3.13-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pymssql-2.3.13-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pymssql-2.3.13-cp312-cp312-musllinux_1_2_aarch64.whl; pymssql-2.3.13-cp312-cp312-musllinux_1_2_x86_64.whl
Keywords: mssql, SQL Server, database, DB-API
About pymssql
from the package's own PyPI description — quoted content, verbatim
pymssql - DB-API interface to Microsoft SQL Server
.. image:: https://github.com/pymssql/pymssql/workflows/Wheels/badge.svg :target: https://github.com/pymssql/pymssql/actions?query=workflow%3A%22Wheels%22
.. image:: http://img.shields.io/pypi/dm/pymssql.svg :target: https://pypi.python.org/pypi/pymssql/
.. image:: http://img.shields.io/pypi/v/pymssql.svg :target: https://pypi.python.org/pypi/pymssql/
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.
.. _Microsoft SQL Server: http://www.microsoft.com/sqlserver/ .. _Python: http://www.python.org/ .. _PEP-249: http://www.python.org/dev/peps/pep-0249/ .. _FreeTDS: http://www.freetds.org/
Detailed information on pymssql is available on the website:
pymssql.readthedocs.io <https://pymssql.readthedocs.io/en/stable/>_
New development is happening on GitHub at:
github.com/pymssql/pymssql <https://github.com/pymssql/pymssql>_
There is a Google Group for discussion at:
`groups.google.com...
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
pymssql provides a Python DB-API interface to Microsoft SQL Server, built on FreeTDS, enabling SQL queries and connection management via standard Python database operations.
Medium friction: prebuilt wheels available for Python 3.9–3.12 across Windows, macOS, and Linux (manylinux, musllinux), but requires pip upgrade on older distributions. Actively maintained with recent releases (180 days since last release) and no runtime dependencies.
Licensed under LGPL 2.1, a copyleft license permitting use in proprietary applications if you do not modify the library itself; modifications or redistribution require source disclosure under the same terms.
Usage
import pymssql
conn = pymssql.connect(server='localhost', user='sa', password='pass', database='tempdb')
cursor = conn.cursor(as_dict=True)
cursor.execute('SELECT * FROM persons WHERE salesrep=%s', 'John Doe')
for row in cursor:
print(row)
conn.close()
Requires a running Microsoft SQL Server instance or compatible server (e.g., Azure SQL); FreeTDS is bundled in official wheels but may need system libraries on some Linux distributions.
Verdict: pymssql is a stable, actively maintained DB-API driver for SQL Server with broad Python version support (3.9–3.14) and prebuilt wheels reducing install friction. LGPL 2.1 licensing permits commercial use without modification. No known vulnerabilities and top-1000 popularity make it a reliable choice for SQL Server integration, though deployment requires an accessible SQL Server instance.
Needs verification
- Whether the bundled FreeTDS in wheels includes all required TLS/SSL libraries for Azure SQL connections on all platforms
- Performance characteristics and connection pooling capabilities compared to other SQL Server drivers
- Compatibility with SQL Server 2019+ specific features or Azure SQL edge cases
Similar packages
permissive · top 1,000 on PyPI
redshift-connectorpermissive · top 1,000 on PyPI
google-cloud-spannerpermissive · top 1,000 on PyPI
PyMySQLpermissive · top 1,000 on PyPI
aiosqlitepermissive · top 1,000 on PyPI
pinotdbpermissive · top 1,000 on PyPI
databricks-sql-connectorpermissive · top 1,000 on PyPI
PyAthenapermissive · top 1,000 on PyPI
prettytablepermissive · top 1,000 on PyPI
dacitepermissive · top 1,000 on PyPI