# Supported Python Libraries

SingleStore supports the following Python libraries.

> **📝 Note**: When using GSSAPI authentication, you must use a library that links against the MariaDB 10.1.11 or greater C bindings.

## SingleStore Python Client

SingleStore recommends using the [SingleStore Python Client](https://docs.singlestore.com/db/v9.1/developer-resources/connect-with-application-development-tools/connect-with-python/connect-using-the-singlestore-python-client.md).

```Shell
pip install singlestoredb
```

## mysqlclient

Refer to [mysqlclient-python](https://github.com/PyMySQL/mysqlclient-python) for information.

```shell
pip install mysqlclient
```

## GSSAPI Authentication Example

You can use GSSAPI authentication via the `mysqlclient` library. Configure SingleStore to use GSSAPI. See [Kerberos Authentication](https://docs.singlestore.com/db/v9.1/security/authentication/kerberos-authentication.md) for more information.

To validate, ensure that your MariaDB packages are version 10.1.11 or greater, and that you do not have conflicting MySQL packages:

**RHEL MariaDB Version Check**

```shell
[ec2-user ~]$ rpm -qa | egrep -i 'mysql|maria'

```

```output

MariaDB-compat-10.2.23-1.el7.centos.x86_64
MariaDB-common-10.2.23-1.el7.centos.x86_64
MariaDB-client-10.2.23-1.el7.centos.x86_64
MariaDB-server-10.2.23-1.el7.centos.x86_64
MariaDB-common-debuginfo-10.2.23-1.el7.centos.x86_64
MariaDB-devel-10.2.23-1.el7.centos.x86_64
```

GSSAPI authentication has been validated with the `mysqlclient-python` client library. At the time of writing, there are no known pure python MySQL connector implementations which support the MariaDB GSSAPI client-side protocol.

The following example authenticates to SingleStore via GSSAPI using `mysqlclient-python`.

Note that the code used to connect for regular connections and Kerberos connections should be the same since the connector is porting the C extensions. This is because the SingleStore server checks grants and sees that the user is authenticated via GSSAPI, and then the client C extensions have an attached handler for GSSAPI, which run independent of the third-party connector.

Add the following code to the **gssapi-test.py** file:

```python
import MySQLdb

# Substitute 'kerberos_principal_name' and change the host ip as required.
conn = MySQLdb.connect(
    user='root',
    host='127.0.0.1',
    database='information_schema')

if conn:
    print("Successfully connected via Kerberos authentication")

cursor = conn.cursor()

query = "SELECT query_text FROM mv_queries"

cursor.execute(text(query))
for qtext in cursor:
    print("{}".format(qtext))

cursor.close()
conn.close()
```

Here's the output:

```shell
[ec2-user ~]$ python gssapi-test.py

```

```output

Successfully connected via Kerberos authentication
('SELECT @@max_allowed_packet,@@system_time_zone,@@time_zone,@@auto_increment_increment',)
('SELECT @@memsql_id',)
('SELECT @@memsql_version',)
('SELECT ACTIVITY_NAME, QUERY_TEXT, PLAN_WARNINGS, PLAN_INFO FROM INFORMATION_SCHEMA.LMV_QUERIES',)
('SELECT WITH(binary_serialization=1, binary_serialization_internal=1) `_WM_AGG_TABLE`.`AGGREGATOR_ACTIVITY_NAME` AS `aggregator_activity_name`, SUM(`_WM_AGG_TABLE`.`ELAPSED_TIME_MS`) AS `elapsed_time_ms`, SUM(`_WM_AGG_TABLE`.`SUCCESS_COUNT`) AS `numRuns` FROM `_WM_AGG_TABLE` as `_WM_AGG_TABLE` GROUP BY 1 OPTION(NO_QUERY_REWRITE=1, INTERPRETER_MODE=LLVM)',)
('SELECT query_text FROM mv_queries',)
('select query_text from mv_queries',)
('SELECT HEARTBEAT_NO_LOGGING agg.AGGREGATOR_ACTIVITY_NAME, coalesce(sum(leaves.memory_bs)*1000/agg.elapsed_time_ms/0x400/0x400, 0):>bigint,coalesce(agg.elapsed_time_ms/agg.numRuns, @):>bigint as avg_runtime, coalesce(sum(leaves.cpu_time_ms)/agg.numRuns, @):>bigint as avg_cpu_time FROM (select aggregator_activity_name, sum(elapsed_time_ms) as elapsed_time_ms, sum(success_count) as numRuns from information_schema._WM_AGG_TABLE group by 1) agg join information_schema._WM_LEAF_TABLE leaves on agg.aggregator_activity_name = leaves.aggregator_activity_name group by agg.AGGREGATOR_ACTIVITY_NAME',)
('select @@version_comment limit @',)
('SELECT @@memsql_id',)
('SELECT @@memsql_version',)
('SELECT AVAILABILITY_GROUP FROM information_schema.LEAVES\nJOIN information_schema.LMV_NODES\nON information_schema.LEAVES.NODE_ID=information_schema.LMV_NODES.NODE_ID',)
('SELECT WITH(binary_serialization=1, binary_serialization_internal=1) `leaves_0`.`MEMORY_BS` AS `MEMORY_BS`, `leaves_0`.`CPU_TIME_MS` AS `CPU_TIME_MS`, `leaves_0`.`AGGREGATOR_ACTIVITY_NAME` AS `AGGREGATOR_ACTIVITY_NAME` FROM `_WM_LEAF_TABLE` as `leaves_0` OPTION(NO_QUERY_REWRITE=1, INTERPRETER_MODE=LLVM)',)
('SELECT SQL_NO_LOGGING 1',)
('SELECT SQL_NO_LOGGING @@maximum_table_memory, @@maximum_memory',)

```

## PyMySQL

Refer to [PyMySQL](https://github.com/PyMySQL/PyMySQL) for information.

```shell
pip install PyMySQL
```

> **📝 Note**: PyMySQL does not support GSSAPI/Kerberos based authentication because this is a pure Python implementation.

## MySQL Connector/Python

> **⚠️ Warning**: The MySQL Connector/Python library is not recommended.

Refer to [MySQL Connector/Python](https://dev.mysql.com/downloads/connector/python/) for information.

```shell
yum install https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.15-1.el7.x86_64.rpm
yum install https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-cext-8.0.15-1.el7.x86_64.rpm
```

| Connector                                     | Binary URL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Source Code                                                                      |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| MySQL Connector/Python Version 2.1.7 (GPLv2)  | [Linux RHEL 6 x86\_64](https://repo.mysql.com/yum/mysql-connectors-community/el/6/x86_64/mysql-connector-python-2.1.7-1.el6.x86_64.rpm)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | [2.1.7.zip](https://github.com/mysql/mysql-connector-python/archive/2.1.7.zip)   |
| MySQL Connector/Python Version 8.0.15 (GPLv2) | [Linux RHEL 7 x86\_64](https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.15-1.el7.x86_64.rpm)[Windows x86\_64 (Python 2.7)](https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.15-py2.7-windows-x86-64bit.msi)[Windows x86\_64 (Python 3.5)](https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.15-py3.5-windows-x86-64bit.msi)[Windows x86\_64 (Python 3.6)](https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.15-py3.6-windows-x86-64bit.msi)[Windows x86\_64 (Python 3.7)](https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.15-py3.7-windows-x86-64bit.msi) | [8.9.15.zip](https://github.com/mysql/mysql-connector-python/archive/8.0.15.zip) |

***

Modified at: August 6, 2025

Source: [/db/v9.1/developer-resources/connect-with-application-development-tools/connect-with-python/supported-python-libraries/](https://docs.singlestore.com/db/v9.1/developer-resources/connect-with-application-development-tools/connect-with-python/supported-python-libraries/)

(An index of the documentation is available at /llms.txt)
