zeekay b79e8fe9b1 gate the extension build instead of a wheel matrix nothing collects
build_wheels.yml built cibuildwheel wheels for macOS, Windows and arm64. This
fleet has no macOS, no Windows and no arm64 runner, so those arms cannot be
scheduled here. Its upload job was guarded `github.repository_owner ==
'pymssql'`, which is false for this fork — from here it produced wheels nothing
ever published.

What replaces it proves the thing that actually breaks: the C extension still
compiles against FreeTDS and the sdist still assembles, on every push. freetds
comes from apt because the extension links against it; upstream gets there by
vendoring FreeTDS into a manylinux image.

Lost: multi-platform wheel building and the PyPI upload, which was inert here.
tests/ is not run — every case opens a connection to a live SQL Server, so it
asserts a database exists rather than that pymssql works.
2026-08-13 21:08:02 -07:00
2025-06-23 21:09:03 -04:00
2026-02-13 23:28:14 -05:00
2010-03-03 11:29:32 +00:00
2025-06-24 20:53:04 -04:00

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 <https://groups.google.com/forum/?fromgroups#!forum/pymssql>`_


Getting started
===============

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

.. code-block:: bash

    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.

.. note::
   On some Linux distributions `pip` version is too old to support all
   the flavors of manylinux wheels, so upgrading `pip` is necessary.
   An example of such distributions would be Ubuntu 18.04 or
   Python3.6 module in RHEL8 and CentOS8.


Basic example
=============

.. code-block:: python

    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()
S
Description
Python DB-API interface to Microsoft SQL Server, built on FreeTDS.
Readme LGPL-2.1
12 MiB
Languages
Python 55.1%
Cython 37.5%
PowerShell 3.1%
Shell 2.3%
Batchfile 1.2%
Other 0.8%