Registry / database / singlestoredb

singlestoredb

JSON →
library1.17.2pypypi✓ verified 25d ago

The SingleStoreDB Python Client is a DB-API 2.0 compliant database connector that provides an interface to the SingleStoreDB database and its workspace management APIs. It supports Python 3.9+ and is designed for high-performance interactions with SingleStoreDB, including real-time analytics and vector search. The library maintains a frequent release cadence, typically with minor updates and patches released monthly or bi-monthly.

pip install singlestoredb
INSTALL
IMPORT
SIG · SINGLESTOREDB
S
singlestoredb
databasepythonv1.17.2
Install
7.6s avg
Import
426ms
Disk
60MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.17.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.915 runs
installs and imports cleanly · install 0.0s · import 0.436s · 56MB
glibc
py 3.10–3.915 runs
installs and imports cleanly · install 7.6s · import 0.416s · 60MB
60MB installed
● package 60MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

connect
✓ from singlestoredb import connect
✗ import singlestoredb as s2 conn = s2.connect(...)

This quickstart demonstrates how to connect to a SingleStoreDB instance using environment variables for credentials, create a table, insert data using parameterized queries, and fetch results. The `with` statements ensure connections and cursors are properly closed.

import singlestoredb as s2 import os # Get connection details from environment variables for security HOST = os.environ.get('SINGLESTOREDB_HOST', '127.0.0.1') PORT = int(os.environ.get('SINGLESTOREDB_PORT', '3306')) USER = os.environ.get('SINGLESTOREDB_USER', 'root') PASSWORD = os.environ.get('SINGLESTOREDB_PASSWORD', 'password') DATABASE = os.environ.get('SINGLESTOREDB_DATABASE', 'test_db') try: # Establish a connection with s2.connect( host=HOST, port=PORT, user=USER, password=PASSWORD, database=DATABASE ) as conn: print("Successfully connected to SingleStoreDB!") # Create a cursor object with conn.cursor() as cur: # Execute a query cur.execute("CREATE TABLE IF NOT EXISTS my_table (id INT, name VARCHAR(255))") cur.execute("INSERT INTO my_table (id, name) VALUES (%s, %s)", (1, 'Alice')) conn.commit() print("Table created and data inserted.") # Fetch results cur.execute("SELECT * FROM my_table") for row in cur.fetchall(): print(row) except s2.Error as e: print(f"Database error: {e}") except Exception as e: print(f"An unexpected error occurred: {e}")
singlestore --version
Debug
Known issues
breakingThe query parameter substitution syntax changed significantly in v0.5.0. Positional parameters changed from `:1` to `%s`, and named parameters from `:key` to `%(key)s`.
fix
Update all SQL queries to use the Python DB-API 2.0 standard substitution syntax (`%s` for positional, `%(key)s` for named parameters).
affects: >=0.5.0
breakingThe `results_format` connection parameter was renamed to `results_type` in v0.5.0.
fix
Replace `results_format` with `results_type` in your `s2.connect()` calls and any configuration.
affects: >=0.5.0
gotchaNot using parameterized queries (e.g., f-strings or direct string concatenation) can lead to SQL injection vulnerabilities and incorrect query parsing.
fix
Always use placeholders (`%s` or `%(key)s`) and pass parameters as a tuple or dictionary to `cursor.execute()`. The client handles proper escaping and quoting.
affects: all
gotchaFailing to close database connections and cursors can lead to resource exhaustion and performance issues.
fix
Use Python's `with` statement for `s2.connect()` and `conn.cursor()` to ensure proper resource management, as shown in the quickstart example.
affects: all
breakingMinimum Python version requirement was raised to 3.8 in v0.8.0. Current version 1.16.9 requires Python 3.9+.
fix
Ensure your environment uses Python 3.9 or higher. For older Python versions, you may need to use an older client version or upgrade your Python environment.
affects: >=0.8.0
Upgrade
Version history
1.17.2latest on PyPI · released Aug 26, 2026
Audit
Dependencies
PyMySQLrequiredThe client is based on PyMySQL but adds performance enhancements and C extensions for faster data reading.
sqlalchemy-singlestoredboptionalProvides SQLAlchemy dialect integration.
ibisoptionalUsed for DataFrame-like operations directly within the database.
pandasoptionalUsed for DataFrame integration with the 'dataframe' extra.
Agent activity
67 hits · last 30 days
node
58
OpenAI (training)
1
Resources
singlestoredb — pip install singlestoredb · libregistry