singlestoredb


Namesinglestoredb JSON
Version 1.15.0 PyPI version JSON
download
home_pagehttps://github.com/singlestore-labs/singlestoredb-python
SummaryInterface to the SingleStoreDB database and workspace management APIs
upload_time2025-07-21 18:24:44
maintainerNone
docs_urlNone
authorSingleStore
requires_python>=3.9
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements build parsimonious PyJWT requests setuptools sqlparams tomli typing_extensions wheel
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # <img src="https://github.com/singlestore-labs/singlestoredb-python/blob/main/resources/singlestore-logo.png" height="60" valign="middle"/> SingleStoreDB Python SDK

This project contains a [DB-API 2.0](https://www.python.org/dev/peps/pep-0249/)
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](https://www.sqlalchemy.org) 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](https://github.com/PyMySQL/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](https://www.singlestore.com/blog/how-to-get-started-with-singlestore/).
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](https://raw.githubusercontent.com/singlestore-labs/singlestoredb-python/main/LICENSE?token=GHSAT0AAAAAABMGV6QPNR6N23BVICDYK5LAYTVK5EA).

## Resources

* [SingleStore](https://singlestore.com)
* [Python](https://python.org)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/singlestore-labs/singlestoredb-python",
    "name": "singlestoredb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "SingleStore",
    "author_email": "support@singlestore.com",
    "download_url": "https://files.pythonhosted.org/packages/ef/34/f4e0453479f4f65d4d93418ceade369f2822532b59b57533ca65c2dfacda/singlestoredb-1.15.0.tar.gz",
    "platform": null,
    "description": "# <img src=\"https://github.com/singlestore-labs/singlestoredb-python/blob/main/resources/singlestore-logo.png\" height=\"60\" valign=\"middle\"/> SingleStoreDB Python SDK\n\nThis project contains a [DB-API 2.0](https://www.python.org/dev/peps/pep-0249/)\ncompatible Python interface to the SingleStore database and workspace management API.\n\n## Install\n\nThis package can be install from PyPI using `pip`:\n```\npip install singlestoredb\n```\n\n## Documentation\n\nhttps://singlestore-labs.github.io/singlestoredb-python\n\n## Usage\n\nConnections to the SingleStore database are made using the DB-API parameters\n`host`, `port`, `user`, `password`, etc, but they may also be done using\nURLs that specify these parameters as well (much like the\n[SQLAlchemy](https://www.sqlalchemy.org) package).\n```\nimport singlestoredb as s2\n\n# Connect using the default connector\nconn = s2.connect('user:password@host:3306/db_name')\n\n# Create a cursor\ncur = conn.cursor()\n\n# Execute SQL\ncur.execute('select * from foo')\n\n# Fetch the results\nprint(cur.description)\nfor item in cur:\n    print(item)\n\n# Close the connection\nconn.close()\n```\n\nConnecting to the HTTP API is done as follows:\n```\n# Use the HTTP API connector\nconn = s2.connect('https://user:password@host:8080/db_name')\n```\n\n## Performance\n\nWhile this package is based on [PyMySQL](https://github.com/PyMySQL/PyMySQL)\nwhich is a pure Python-based MySQL connector, it adds various performance\nenhancements that make it faster than most other connectors. The performance\nimprovements come from changes to the data conversion functions, cursor implementations,\nand a C extension that is highly optimized to improve row data reading.\n\nThe package can be used both in a pure Python mode and as well as a C accelerated\nmode. Generally speaking, the C accelerated version of the client can read\ndata 10X faster than PyMySQL, 2X faster than MySQLdb, and 1.5X faster than\nmysql.connector. All of this is done without having to install any 3rd party\nMySQL libraries!\n\nBenchmarking was done with a table of 3,533,286 rows each containing a datetime,\na float, and eight character columns. The data is the same data set used in\n[this article](https://www.singlestore.com/blog/how-to-get-started-with-singlestore/).\nThe client and server were running on the same machine and queries were made\nusing `fetchone`, `fetchall`, `fetchmany(1000)`, and an iterator over the cursor\nobject (e.g., `iter(cur)`). The results are shown below.\n\n### Buffered\n\n|                         | PyMySQL | MySQLdb | mysql.connector | SingleStore (pure Python) | SingleStore |\n|-------------------------|---------|---------|-----------------|---------------------------|-------------|\n| fetchall                |   37.0s |    8.7s |            5.6s |                     29.0s |        3.7s |\n| fetchmany(1000)         |   37.4s |    9.2s |            6.2s |                     29.6s |        3.6s |\n| fetchone                |   38.2s |   10.1s |            10.2s |                     30.9s |        4.8s |\n| iter(cur)               |   38.3s |    9.1s |            10.2s |                     30.4s |        4.4s |\n\n### Unbuffered\n\n|                         | PyMySQL | MySQLdb | mysql.connector | SingleStore (pure Python) | SingleStore |\n|-------------------------|---------|---------|-----------------|---------------------------|-------------|\n| fetchall                |   39.0s |    6.5s |            5.5s |                     30.3s |        5.5s |\n| fetchmany(1000)         |   39.4s |    7.0s |            6.0s |                     30.4s |        4.1s |\n| fetchone                |   34.5s |    8.9s |           10.1s |                     30.8s |        6.6s |\n| iter(cur)               |   39.0s |    9.0s |           10.2s |                     31.4s |        6.0s |\n\n\n## License\n\nThis library is licensed under the [Apache 2.0 License](https://raw.githubusercontent.com/singlestore-labs/singlestoredb-python/main/LICENSE?token=GHSAT0AAAAAABMGV6QPNR6N23BVICDYK5LAYTVK5EA).\n\n## Resources\n\n* [SingleStore](https://singlestore.com)\n* [Python](https://python.org)\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Interface to the SingleStoreDB database and workspace management APIs",
    "version": "1.15.0",
    "project_urls": {
        "Homepage": "https://github.com/singlestore-labs/singlestoredb-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a63fa31e1b54dc4c35b2ab9a7a6d15f0c1529ef02fdec49e6de961f31e543dab",
                "md5": "424ac97d513aeff7f7ba1410c9e33921",
                "sha256": "30e9432febe831784cb363135cd1103ce0065a05c834901b021977bffb5f1a74"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0-cp38-abi3-macosx_10_9_universal2.whl",
            "has_sig": false,
            "md5_digest": "424ac97d513aeff7f7ba1410c9e33921",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.9",
            "size": 420312,
            "upload_time": "2025-07-21T18:24:36",
            "upload_time_iso_8601": "2025-07-21T18:24:36.663981Z",
            "url": "https://files.pythonhosted.org/packages/a6/3f/a31e1b54dc4c35b2ab9a7a6d15f0c1529ef02fdec49e6de961f31e543dab/singlestoredb-1.15.0-cp38-abi3-macosx_10_9_universal2.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05da07f4ffeb32ab28600a1fd74a422e5ffdd712d882de60cc8cd6b673b6b221",
                "md5": "ff8061c95943ec89aef137dfe7222c80",
                "sha256": "6641ca8479c836fe80440cbfc2c082b41b2c176990504db86ed65a60368873cf"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "has_sig": false,
            "md5_digest": "ff8061c95943ec89aef137dfe7222c80",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.9",
            "size": 458513,
            "upload_time": "2025-07-21T18:24:38",
            "upload_time_iso_8601": "2025-07-21T18:24:38.283312Z",
            "url": "https://files.pythonhosted.org/packages/05/da/07f4ffeb32ab28600a1fd74a422e5ffdd712d882de60cc8cd6b673b6b221/singlestoredb-1.15.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f555dc8355415f21f348d028af3039eef9ed3dcbaa0893345a6c843f9a63b551",
                "md5": "27fd637d587af4d27a1a11606234a9e5",
                "sha256": "859a52695818ffa4de1aae31345b32e1b4bcfd9565e708fe7966b33e6eef48f9"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "27fd637d587af4d27a1a11606234a9e5",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.9",
            "size": 459925,
            "upload_time": "2025-07-21T18:24:39",
            "upload_time_iso_8601": "2025-07-21T18:24:39.523560Z",
            "url": "https://files.pythonhosted.org/packages/f5/55/dc8355415f21f348d028af3039eef9ed3dcbaa0893345a6c843f9a63b551/singlestoredb-1.15.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e4e94c8428567efe8e08be038d4da8477970bcf26a908589f18a35ec776ff68",
                "md5": "32c8fee02382491e95471e81e556eb9a",
                "sha256": "66508c0e1a2b2832aaef8c676ae503a74a98c61bafbed7c287cc8ba49be43825"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0-cp38-abi3-win32.whl",
            "has_sig": false,
            "md5_digest": "32c8fee02382491e95471e81e556eb9a",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.9",
            "size": 397812,
            "upload_time": "2025-07-21T18:24:40",
            "upload_time_iso_8601": "2025-07-21T18:24:40.786472Z",
            "url": "https://files.pythonhosted.org/packages/3e/4e/94c8428567efe8e08be038d4da8477970bcf26a908589f18a35ec776ff68/singlestoredb-1.15.0-cp38-abi3-win32.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b838ae2867044880b060c7cc058302caea5666cda4a630cc53168016a83bac33",
                "md5": "deae84a6d7f8b6870139397495396ef0",
                "sha256": "9b60ea1a56d459ff3d2d2bdf9c38ac48564e7e86de6b0679adcab7e139396056"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0-cp38-abi3-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "deae84a6d7f8b6870139397495396ef0",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.9",
            "size": 396543,
            "upload_time": "2025-07-21T18:24:42",
            "upload_time_iso_8601": "2025-07-21T18:24:42.008148Z",
            "url": "https://files.pythonhosted.org/packages/b8/38/ae2867044880b060c7cc058302caea5666cda4a630cc53168016a83bac33/singlestoredb-1.15.0-cp38-abi3-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4894ca0d35fe00a0263ded58e9188c58a2b7b6f8e8c2f5f42591d806f98e3aa2",
                "md5": "68014542eba4352ac4fe0d29fd3f9212",
                "sha256": "b9abbf700a56e9db23531c99365b4ade8e0107dd63dacbc6ae41db9c8954bb1c"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "68014542eba4352ac4fe0d29fd3f9212",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 365184,
            "upload_time": "2025-07-21T18:24:42",
            "upload_time_iso_8601": "2025-07-21T18:24:42.921567Z",
            "url": "https://files.pythonhosted.org/packages/48/94/ca0d35fe00a0263ded58e9188c58a2b7b6f8e8c2f5f42591d806f98e3aa2/singlestoredb-1.15.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef34f4e0453479f4f65d4d93418ceade369f2822532b59b57533ca65c2dfacda",
                "md5": "9b5664174a7bff191f73a569aa37c79e",
                "sha256": "9eca4ee68942a55680694b0a9c42869df95982d3fe43fa573894e341aba6c698"
            },
            "downloads": -1,
            "filename": "singlestoredb-1.15.0.tar.gz",
            "has_sig": false,
            "md5_digest": "9b5664174a7bff191f73a569aa37c79e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 330920,
            "upload_time": "2025-07-21T18:24:44",
            "upload_time_iso_8601": "2025-07-21T18:24:44.174973Z",
            "url": "https://files.pythonhosted.org/packages/ef/34/f4e0453479f4f65d4d93418ceade369f2822532b59b57533ca65c2dfacda/singlestoredb-1.15.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-21 18:24:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "singlestore-labs",
    "github_project": "singlestoredb-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "build",
            "specs": []
        },
        {
            "name": "parsimonious",
            "specs": []
        },
        {
            "name": "PyJWT",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        },
        {
            "name": "sqlparams",
            "specs": []
        },
        {
            "name": "tomli",
            "specs": [
                [
                    ">=",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "<=",
                    "4.13.2"
                ]
            ]
        },
        {
            "name": "wheel",
            "specs": []
        }
    ],
    "lcname": "singlestoredb"
}
        
Elapsed time: 0.49879s