Skip to main content

Interface to the SingleStoreDB database and workspace management APIs

Project description

SingleStoreDB Python SDK

This project contains a DB-API 2.0 compatible Python interface to the SingleStore database and workspace management API.

Install

This package can be install from PyPI using pip:

pip install singlestoredb

Documentation

https://singlestore-labs.github.io/singlestoredb-python

Usage

Connections to the SingleStore database are made using the DB-API parameters host, port, user, password, etc, but they may also be done using URLs that specify these parameters as well (much like the SQLAlchemy package).

import singlestoredb as s2

# Connect using the default connector
conn = s2.connect('user:password@host:3306/db_name')

# Create a cursor
cur = conn.cursor()

# Execute SQL
cur.execute('select * from foo')

# Fetch the results
print(cur.description)
for item in cur:
    print(item)

# Close the connection
conn.close()

Connecting to the HTTP API is done as follows:

# Use the HTTP API connector
conn = s2.connect('https://user:password@host:8080/db_name')

Performance

While this package is based on PyMySQL which is a pure Python-based MySQL connector, it adds various performance enhancements that make it faster than most other connectors. The performance improvements come from changes to the data conversion functions, cursor implementations, and a C extension that is highly optimized to improve row data reading.

The package can be used both in a pure Python mode and as well as a C accelerated mode. Generally speaking, the C accelerated version of the client can read data 10X faster than PyMySQL, 2X faster than MySQLdb, and 1.5X faster than mysql.connector. All of this is done without having to install any 3rd party MySQL libraries!

Benchmarking was done with a table of 3,533,286 rows each containing a datetime, a float, and eight character columns. The data is the same data set used in this article. The client and server were running on the same machine and queries were made using fetchone, fetchall, fetchmany(1000), and an iterator over the cursor object (e.g., iter(cur)). The results are shown below.

Buffered

PyMySQL MySQLdb mysql.connector SingleStore (pure Python) SingleStore
fetchall 37.0s 8.7s 5.6s 29.0s 3.7s
fetchmany(1000) 37.4s 9.2s 6.2s 29.6s 3.6s
fetchone 38.2s 10.1s 10.2s 30.9s 4.8s
iter(cur) 38.3s 9.1s 10.2s 30.4s 4.4s

Unbuffered

PyMySQL MySQLdb mysql.connector SingleStore (pure Python) SingleStore
fetchall 39.0s 6.5s 5.5s 30.3s 5.5s
fetchmany(1000) 39.4s 7.0s 6.0s 30.4s 4.1s
fetchone 34.5s 8.9s 10.1s 30.8s 6.6s
iter(cur) 39.0s 9.0s 10.2s 31.4s 6.0s

License

This library is licensed under the Apache 2.0 License.

Resources

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

singlestoredb-1.16.9.tar.gz (376.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

singlestoredb-1.16.9-py3-none-any.whl (424.4 kB view details)

Uploaded Python 3

singlestoredb-1.16.9-cp38-abi3-win_amd64.whl (456.5 kB view details)

Uploaded CPython 3.8+Windows x86-64

singlestoredb-1.16.9-cp38-abi3-win32.whl (458.0 kB view details)

Uploaded CPython 3.8+Windows x86

singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (939.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (938.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

singlestoredb-1.16.9-cp38-abi3-macosx_10_9_universal2.whl (481.2 kB view details)

Uploaded CPython 3.8+macOS 10.9+ universal2 (ARM64, x86-64)

File details

Details for the file singlestoredb-1.16.9.tar.gz.

File metadata

  • Download URL: singlestoredb-1.16.9.tar.gz
  • Upload date:
  • Size: 376.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for singlestoredb-1.16.9.tar.gz
Algorithm Hash digest
SHA256 92e72112268ec362c19b1923eeff7a8da31d756b9ae1060e0eaf8eb03db3596d
MD5 7dfe0645327fdc3f8a286cce7f2076ec
BLAKE2b-256 94154ae4f961f939574f328db4a9d0de8698bdf8b174579274a47625f9f1002e

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9.tar.gz:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file singlestoredb-1.16.9-py3-none-any.whl.

File metadata

  • Download URL: singlestoredb-1.16.9-py3-none-any.whl
  • Upload date:
  • Size: 424.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for singlestoredb-1.16.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e632ce2fb3df19aa66f265110224372f5511e1aa995c1b661c8a46ef0bb7099d
MD5 6a045ead45c687591d713798259d868d
BLAKE2b-256 244bdbfe36798b1349a231ee28c0791bc04f786701d49fdf77f22f8d265647df

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9-py3-none-any.whl:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file singlestoredb-1.16.9-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for singlestoredb-1.16.9-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7277e82f5900e261742b7476712953a214940ce52b623a7879c6589932be2f55
MD5 18cc585a1281f0ecf6826f1d9d650497
BLAKE2b-256 000bde8fcacc8e4dff819501401395aeccdb09138e7a2ba6947a7eac1b6f1823

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9-cp38-abi3-win_amd64.whl:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file singlestoredb-1.16.9-cp38-abi3-win32.whl.

File metadata

  • Download URL: singlestoredb-1.16.9-cp38-abi3-win32.whl
  • Upload date:
  • Size: 458.0 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for singlestoredb-1.16.9-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 c5141337497856e9c743cdfbf8501416e8dfffd5dbc3d3cc7578f00be0e6a7b9
MD5 f4c355756e09c92f37c86b4df8c6fa30
BLAKE2b-256 d980d02c37233c6dbb7038ac44b1d6a26339e2425667ac813ea562303b23bac6

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9-cp38-abi3-win32.whl:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab89d9b3b3c774e44fecb0a1fb179960150a0e56589f6305470c1db3b6404c2b
MD5 58721b560b43751984fa8a132b0fa534
BLAKE2b-256 fe6aeb0893d555798582fb594d4dd0f722f4118d845e2f47ffa71866e908c9fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0e958dec4387a4f86c14a73167c120f6637281362e281c4329e3d5bdee55dc43
MD5 330183ab6c97039d6e6c9543e0be1290
BLAKE2b-256 8074014fa784fb27bed36d69bd4dd64b3c776c06c71c7b1b4a6a349d34aa05cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file singlestoredb-1.16.9-cp38-abi3-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for singlestoredb-1.16.9-cp38-abi3-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 d36d8daa58ad0bce924b479535a20c05a063627fdc5f48d680e1787ddf168802
MD5 e52b4937da10ad427cf9579f21e167f0
BLAKE2b-256 75a895612fb8d3fbf0dd7e624ff06e436920bea44365d5e525f388d0740c6c74

See more details on using hashes here.

Provenance

The following attestation bundles were made for singlestoredb-1.16.9-cp38-abi3-macosx_10_9_universal2.whl:

Publisher: publish.yml on singlestore-labs/singlestoredb-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page