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 singlestoredbVerified import paths — ran on the pinned version, not inferred.
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.
Update all SQL queries to use the Python DB-API 2.0 standard substitution syntax (`%s` for positional, `%(key)s` for named parameters).
Replace `results_format` with `results_type` in your `s2.connect()` calls and any configuration.
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.
Use Python's `with` statement for `s2.connect()` and `conn.cursor()` to ensure proper resource management, as shown in the quickstart example.
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.