NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #509 most downloaded on PyPI
DB-API interface to Microsoft SQL Server for Python. (new Cython-based version)
Last release 8 days ago
27 Sep 2026
Release timing varies
gaps range from 2 weeks to 7 months
Most releases are documented
notes for 35 of 45 stable releases
Nothing withdrawn
no release was ever pulled
18 years old
47 releases · first in 2009
Fix deadlock in err_handler (#1002), thanks to sergiopmscope.
Fix deadlock in err_handler (#1002), thanks to sergiopmscope.
Fix socket resource leak on failed connections (#1002), thanks to gintsmurans.
Fix socket resource leak on failed connections (#1002), thanks to gintsmurans.
Enable free-threaded Python 3.14 wheel builds (#1004).
Add wheels for Python 3.15 (PR #1016), thanks to edgarrmondragon.
One column per quarter.
Update license information in pyproject.toml, thanks to ecederstrand (PR #1003).
Update license information in pyproject.toml, thanks to ecederstrand (PR #1003).
Update win-iconv to 0.0.10.
Fix datetime conversion for BCP operations and build on Windows (PR #1015).
Update to latest OpenSSL version on Windows (currently 4.0.2).
Update FreeTDS to 1.5.19 for wheels.
Fix type stubs with generics, overloads, and corrected types, thanks to jacks0n.
Fix type stubs with generics, overloads, and corrected types, thanks to jacks0n.
Update manylinux base image to manylinux_2_28 to fix CVE-2023-0464, thanks to grgalex@ba.uoa.gr.
Update manylinux base image to manylinux_2_28 to fix CVE-2023-0464, thanks to grgalex@ba.uoa.gr.
Drop build of MacOS-13 wheels (The macOS-13 based runner images are now retired on GitHub).
Drop build of MacOS-13 wheels (The macOS-13 based runner images are now retired on GitHub).
Bump actions/upload-artifacts and actions/download-artifacts.
Update psutil requirement to <7.2.2 for testing wheels.
Improve executemany to get every batch result and check for the total query size (for #952).
Add get_cur_db() method to MSSQLConnection, thanks to jnahmias (PR #979).
Add get_cur_db() method to MSSQLConnection, thanks to jnahmias (PR #979).
Fix build with Cython-3.2.0, thanks to mkeener (PR #977).
Fix build with Cython-3.2.0, thanks to mkeener (PR #977).
Build Python 3.14 wheels, thanks to Edgar Ramírez Mondragón (PR #964).
Build Python 3.14 wheels, thanks to Edgar Ramírez Mondragón (PR #964).
Allow to specify openssl dependency on macos, thanks to dwt (PR #934).
Allow to specify openssl dependency on macos, thanks to dwt (PR #934).
Build manylinux wheels using manylinux2014 image.
Build manylinux wheels using manylinux2014 image.
Build ARM wheels for MacOS (closes #612, #727, #731, #763, #768, #822, #882).
Build ARM wheels for MacOS (closes #612, #727, #731, #763, #768, #822, #882).
Fix Windows wheels build (closes #930, #931).
Make mssql cython 3.1.0 compatible, thanks to Timotheus Bachinger (closes #937, #939, #945, #946, #948).
Fix manylinux1 build for Cython-3.1.0.
Fix sqlalchemy.orm.exc.MappedAnnotationError in tests, thanks to Timotheus Bachinger.
Use cibuildwheel in GitHub Actions.
Update packaging to fix metadata, thanks to AbigailColwell.
Update packaging to fix metadata, thanks to AbigailColwell.
Add py.typed which marks pymssql as suporting typechecks, thanks Niklas Mertsch (closes #925).
Update FreeTDS to 1.4.26.
Add py.typed which marks pymssql as suporting typechecks, thanks Niklas Mertsch (closes #925).
Build wheels for Python-3.13 on Windows and MacOS.
Update FreeTDS to 1.4.23.
Build wheels for Python-3.13 on Windows and MacOS.
Fix build wheels for Python-3.13 on Windows.
Drop build in actions for Python 3.6, 3.7 and 3.8.
Add build in actions for Python-3.13.
Workaround setuptools-74.0 changes.
Fix SP returning NULL (closes #441).
Fix SP returning NULL (closes #441).
Update FreeTDS to 1.4.22 (closes #895).
Require Cython>3.0.10.
Add python 3.13 Linux wheels (closes #900).
Drop manylinux2010 wheels.
Drop 3.7 and 3.8 wheels on MacOS.
Drop 3.6 wheels on Linux.
Add python 3.12 support (fix #851). Thanks to Raphael Jacob.
Add python 3.12 support (fix #851). Thanks to Raphael Jacob.
Update FreeTDS to 1.4.10.
Add read_only parameter for connection.
Add encryption parameter to connect.
Add use_datetime2 parameter to connect.
Use utf-8 for connection properties.
Implement batching in executemany based on optional batch_size parameter. with default equal arraysize cursor attribute (closes #332, #462).
Build aarch64 wheels. Thanks to Jun Tang.
Build musllinux wheels.
Some documentation fixes. Thanks to Casey Korver and Quentin LEGAY.
FAQ update: #877.
Add stubs (closes #767).
Fix DBAPI-2.0 compliance - DataError must be a subclass of DatabaseError.
Fix DBAPI-2.0 compliance: rename batchsize cursor attribute to arraysize.
Implement DATETIMEOFFSET handling for stored procedures.
Implement DATETIMEOFFSET handling for insert and select queries (fixes #649).
Return instance of datetime.datetime on select from SQLDATETIM4, SQLDATETIME, SQLDATETIME2 columns (closes #662, #695, #792, #844).
Fix SQLDATETIME2 handling in convert_python_value().
Use four digits for the year in SP args binding (fix #454).
Fix convert_python_value to work with datetime.date. Thanks to Testsr.
Check if C compiler is installed if check for clock_gettime fails (fix #825).
Add missing charset parameter in the _substitute_params method when calling ensure_bytes (fix #650). Thans to Andrey Yuroshev.
Fix empty, zero or None parameter substitution. (fix #609).
Add tests for fetchall(), fetchmany(), fetchone() and next() with SP.
Add test for #134.
Require Cython>3.0.7.
Use Cython 3 for compilation.
Use docker image for MSSQL2019 as a default for tests.
Take FreeTDS version for PyPI wheels from pyproject.toml.
Check sdist with twine.
Use OpenSSL-1.1.1.2100 for Windows x86 wheels. Thanks to PrimozGodec (fixes #839).
Use OpenSSL-3.1.1 for Windows x64 wheels (FreeTDS build fails with OpenSSL-3.2.1).
Add SQLTIME and SQLDATETIME2 to convert_python_value.
Use dbanydatecrack() function instead of dbdatecrack().
Replace DEF with cdef enum for buffer array size (compatibility with Cython 3).
Remove references to tox. Thanks to Christoph Wegener.
Update readthedocs configuration.
Add tests for timeout in wait callback (#305).
Clean up some legacy FreeTDS shims.
Add tests for tds_version parameter.
Move check for clock_gettime to dev/ccompiler.py.
Remove some Python2 remnants.
Move FreeTDS version from workflow files to pyproject.toml.
Move exceptions into separate module.
Use strftime for date & time conversion.
Simplify parameters quoting.
Add tests for _quote_simple_value.
Use FreeTDS-1.4.9 for official wheels on PyPi.
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).
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).
Publish Linux wheels for Python-3.12
Publish Linux wheels for Python-3.12
Use FreeTDS-1.4.3 for official wheels on PyPi (fix #847).
Use FreeTDS-1.4.3 for official wheels on PyPi (fix #847).
Build wheels for Python-3.12. Thanks to Raphael Jacob (fix #851, #855).
Use manylinux_2_28 instead of manylinux_2_24 when building wheels in GitHub actions.
Fix build with OpenSSL on Windows. Thanks to PrimozGodec (fix #839).
Compatibility with Cython. Thanks to matusvalo (Matus Valo) (fix #826).
Compatibility with Cython. Thanks to matusvalo (Matus Valo) (fix #826).
Build wheels for Python-3.6 (fix 787).
Build wheels for Python-3.6 (fix 787).
Use FreeTDS-1.3.13 for official wheels on PyPi.
Build wheels for Python-3.11.
Use FreeTDS-1.3.13 for official wheels on PyPi.
Fix build on Alpine Linux (fix #762).
Fill in result description in cursor.callproc (fix #772).
Add explicit link to krb5 (fix #776), thanks to James Coder.
Some small doc fixes, thanks to guillaumep and Logan Elandt.
Added bytes and bytearray to support bulk_copy types, thanks to steve-strickland (#756).
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).
Build wheels for Python-3.10 on Linux.
Build wheels for Python-3.10 on Linux.
Fix include paths in setup.py.
Use FreeTDS-1.3.4 for official wheels on PyPi.
Build wheels for Python-3.10.
Use FreeTDS-1.3.4 for official wheels on PyPi.
Enable krb5 in Linux wheels (#734).
Fix UnicodeEncodeError for non-ascii database name (#484).
Fix pymssql.Binary (#504).
On macOS check for FreeTDS in homebrew prefix when building.
Some documentation changes.
Use FreeTDS-1.3 for official wheels on PyPi.
Use FreeTDS-1.3 for official wheels on PyPi.
On macOS use delocate to bundle dependencies when building wheels.
Some documentation changes.
Publish Linux wheels for the all supported platforms. manylinux1 wheels are not compatible with modern glibc and OpenSSL.
Publish Linux wheels for the all supported platforms. manylinux1 wheels are not compatible with modern glibc and OpenSSL.
Add readthedocs configuration file.
Nothing published for this version
Add Python-3.9 to the build and test matrix.
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.
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.
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.
Introduce script dev/build.py to build FreeTDS and pymssql wheels.
Simplify setup.py, introduce environment variables to select FreeTDS includes and libraries.
Support Python-3.8. Update tests for Python-3.8 compatibility.
Revert deprecation
Support Python-3.8. Update tests for Python-3.8 compatibility.
Use correct language level for building Cython extension.
Fix FreeTDS version checks. Add check for version 7.4.
Use Github Actions for building wheels for Linux, macOS and Windows.
Drop bundled FreeTDS-0.95 binaries.
Unless some critical bug is discovered, this will be the last release with Python2 support.
This is a backward incompatible change and affects connections using both pymssql and _mssql.
Allow linkage against FreeTDS (by dropping usage of deprecated DBVERSION_80 symbol.) (GH-432)
Stop using 7.1 as default value for the TDS protocol version used in connections.
This is a backward incompatible change and affects connections using both pymssql and _mssql.
Now you need to specify a TDS protocol version explicitly by using any of the supported mechanisms (in descending order of precedence):
Using the tds_version paramenter of pymssql.connect() and _mssql.connect()
A TDSVER enviromnent variable (see FreeTDS documentation)
A freetds.conf file (see FreeTDS documentation)
Drop support for versions of FreeTDS older than 0.91.
Accept 7.3 as TDS protocol version when establishing a connection.
Add Python 3.7 support
Drop Python 3.3 support
Support for new in SQL Server 2008 DATE, TIME and DATETIME2 data types (GH-156). The following conditions need to be additionally met so values of these column types can be returned from the database as their native corresponding Python data types instead of as strings:
Underlying FreeTDS must be 0.95 or newer.
TDS protocol version in use must be 7.3 or newer.
Thanks Ed Avis for the implementation. (GH-331)
Finish implementation of TDS protocol version 7.3 support by actually accepting "7.3" as TDS protocol version when establishing a connection. (GH-455)
Fixed and expanded Python data types that can be used to pass VARBINARY, BINARY and IMAGE SQL Server Stored Procedures input parameters. (GH-425). Thanks Bill Adams for the fix.
Fix tds_version _mssql connection property value for TDS version. 7.1 is actually 7.1 and not 8.0.
Nothing published for this version
Windows official binaries: Rollback changes to Windows binaries we had implemented in pymssql 2.1.2; go back to using:
Windows official binaries: Rollback changes to Windows binaries we had implemented in pymssql 2.1.2; go back to using:
A statically linked version of FreeTDS (v0.95.95)
No SSL support
Update bundled Linux static version of FreeTDS to v0.95.95.
We now publish Linux PEP 513 manylinux wheels on PyPI.
Add support for reporting TDS version 7.3 is in use via the tds_version property of a _mssql-level connection.
.. attention:: Windows users: You need to download and install additional DLLs
Attention!
Windows users: You need to download and install additional DLLs
pymssql version 2.1.2 includes a change in the official Windows binaries: FreeTDS isn't statically linked as it happened up to release 2.1.1, as that FreeTDS copy lacked SSL support.
Please see http://pymssql.org/en/latest/freetds.html#windows for futher details.
We are trying to find a balance between security and convenience and will be evaluating the situation for future releases. Your feedback is greatly welcome.
Drop support for Python 2.6.
Add support for Python 3.5.
Update shipped Linux FreeTDS static libs to 0.95
Add ability to set TDS protocol version from pymssql when connecting to SQL Server. For the remaining pymssql 2.1.x releases its default value will be 7.1 (GH-323)
Add Dockerfile and a Docker image and instructions on how to use it (GH-258). This could be a convenient way to use pymssql without having to build stuff. See http://pymssql.readthedocs.org/en/latest/intro.html#docker Thanks Marc Abramowitz.
Floating point values are now accepted as Stored Procedure arguments (GH-287). Thanks Runzhou Li (Leo) for the report and Bill Adams for the implementation.
Send pymssql version in the appname TDS protocol login record field when the application doesn't provide one (GH-354)
Fix a couple of very common causes of segmentation faults in presence of network a partition between a pymssql-based app and SQL Server (GH-147, GH-271) Thanks Marc Abramowitz. See also GH-373.
Fix failures and inconsistencies in query parameter interpolation when UTF-8-encoded literals are present (GH-185). Thanks Bill Adams. Also, GH-291.
Fix login_timeout parameter of pymssql.connect() (GH-318)
Fixed some cases of cursor.rowcont having a -1 value after iterating over the value returned by pymssql cursor fetchmany() and fetchone() methods (GH-141)
Remove automatic treatment of string literals passed in queries that start with '0x' as hexadecimal values (GH-286)
Fix build fatal error when using Cython >= 0.22 (GH-311)
Add installation instructions. Thanks Marc Abramowitz.
Document DB-API-mandated exceptions.
Enhance _mssql.MSSQLStoredProcedure.bind() docs.
Enhance description of Azure connections requirements.
Add Appveyor hosted CI setup for running tests on Windows (GH-347)
Travis CI: Use newer, faster, container-based infrastructure. Also, test against more than one FreeTDS version.
Make it possible to build official release files (sdist, wheels) on Travis & AppVeyor.
Custom message handlers (GH-139)
Custom message handlers (GH-139)
The DB-Library API includes a callback mechanism so applications can provide functions known as message handlers that get passed informative messages sent by the server which then can be logged, shown to the user, etc.
_mssql now allows you to install your own message handlers written in Python. See the _msssql examples and reference sections of the documentation for more details.
Thanks Marc Abramowitz.
Compatibility with Azure
It is now possible to transparently connect to SQL Server instances accessible as part of the Azure cloud services.
Note
If you need to connect to Azure make sure you use FreeTDS 0.91 or newer.
Customizable per-connection initialization SQL clauses (both in pymssql and _mssql) (GH-97)
It is now possible to customize the SQL statements sent right after the connection is established (e.g. 'SET ANSI_NULLS ON;'). Previously it was a hard-coded list of queries. See the _mssql.MSSQLConnection documentation for more details.
Thanks Marc Abramowitz.
Added ability to handle instances of uuid.UUID passed as parameters for SQL queries both in pymssql and _mssql. (GH-209)
Thanks Marat Mavlyutov.
Allow using SQL Server autocommit mode from pymssql at connection opening time. This allows e.g. DDL statements like DROP DATABASE to be executed. (GH-210)
Thanks Marat Mavlyutov.
Documentation: Explicitly mention minimum versions supported of Python (2.6) and SQL Server (2005).
Incremental enhancements to the documentation.
Handle errors when calling Stored Procedures via the .callproc() pymssql cursor method. Now it will raise a DB-API DatabaseException; previously it allowed a _mssql.MSSQLDatabaseException exception to surface.
Fixes in tds_version _mssql connections property value
Made it work with TDS protocol version 7.2. (GH-211)
The value returned for TDS version 7.1 is still 8.0 for backward compatibility (this is because such feature got added in times when Microsoft documentation labeled the two protocol versions that followed 7.0 as 8.0 and 9.0; later it changed them to 7.1 and 7.2 respectively) and will be corrected in a future release (2.2).
PEP 249 compliance (GH-251)
Added type constructors to increase compatibility with other libraries.
Thanks Aymeric Augustin.
pymssql: Made handling of integer SP params more robust (GH-237)
Check lower bound value when convering integer values from to Python to SQL (GH-238)
Completed migration of the test suite from nose to py.test.
Added a few more test cases to our suite.
Tests: Modified a couple of test cases so the full suite can be run against SQL Server 2005.
Added testing of successful build of documentation to Travis CI script.
Build process: Cleanup intermediate and ad-hoc anciliary files (GH-231, GH-273)
setup.py: Fixed handling of release tarballs contents so no extraneous files are shipped and the documentation tree is actually included. Also, removed unused code.
Nothing published for this version
Nothing published for this version
This is a new major version of pymssql. It is totally rewritten from scratch in Cython. Our goals for this version were to:
This is a new major version of pymssql. It is totally rewritten from scratch in Cython. Our goals for this version were to:
Provide support for Python 3.0 and newer,
Implement support for stored procedures,
Rewrite DB-API compliant pymssql module in C (actually in Cython) for increased performance,
Clean up the module API and the code.
That's why we decided to bump major version number. Unfortunately new version introduces incompatible changes in API. Existing scripts may not work with it, and you'll have to audit them. If you care about compatibility, just continue using pymssql 1.0.x and slowly move to 2.0.
Project hosting has also changed. Now pymssql is developed on GitHub: http://github.com/pymssql/pymssql.
Credits for the release go to:
Marc Abramowitz <msabramo_at_gmail_com> who joined the project in Jan 2013 and is responsible for the actual release of the 2.0 version by fixing many old tickets, coding the port to Python 3 and driving the migration to Git and GitHub.
Randy Syring who converted the repository to Mercurial, extended tests and ported them to nose, enhanced the code in several fronts like multi-platform (compilers, OSes) compatibility, error handling, support of new data types, SQLAlchemy compatibility and expanded the documentation.
Damien Churchill <damoxc_at_gmail_com> who set the foundations of the new Cython-based code base, release engineering, new site features like Sphinx, SimpleJSON and others,
Andrzej Kukuła <akukula_at_gmail_com> who did all the docs, site migration, and other boring but necessary stuff.
Jooncheol Park <jooncheol_at_gmail_com> who did develop the initial version of pymssql (until 0.5.2). Now just doing boring translation docs for Korean.
Rewritten from scratch in C, you should observe even better performance than before
dsn parameter to pymssql.connect() has been removed
host parameter to pymssql.connect() has been renamed to server to be consistent with _mssql module
max_conn parameter to pymssql.connect() has been removed
autocommit() function has been changed to pymssql.Connection.autocommit property that you can set or get its current state.
fetchone_asdict() method has been removed. Just use pymssql.connect() with as_dict=True, then use regular ~pymssql.Cursor.fetchone()
fetchmany_asdict() method has been removed. Just use pymssql.connect() with as_dict=True, then use regular ~pymssql.Cursor.fetchmany()
fetchall_asdict() method has been removed. Just use pymssql.connect() with as_dict=True, then use regular ~pymssql.Cursor.fetchall()
Added native support for stored procedures (~_mssql.MSSQLStoredProcedure class)
maxconn parameter to _mssql.connect() has been removed
timeout and login_timeout parameter to _mssql.connect() has been added
~_mssql.get_max_connections() and ~_mssql.set_max_connections() module-level methods have been added
Class names have changed:
Old Name |
New name |
|---|---|
MssqlException |
MSSQLException |
MssqlDriverException |
MSSQLDriverException |
MssqlDatabaseException |
MSSQLDatabaseException |
MssqlRowIterator |
MSSQLRowIterator |
MssqlConnection |
MSSQLConnection |
Added ~_mssql.MSSQLConnection.tds_version property.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →