Name | msqlite JSON |
Version |
0.4.0
JSON |
| download |
home_page | None |
Summary | Execute simple SQLite statements that are multithreaded/multiprocess safe |
upload_time | 2024-05-17 03:39:37 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License Copyright (c) 2024 James Abel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
sqlite
multithread
multiprocess
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# msqlite
Multi-threaded/multi-process support on top of SQLite. The intent is to ensure a SQL statement
will get executed, even if other threads or processes are trying to access the DB. Avoids
`database is locked` issues.
No additional package dependencies beyond regular Python.
Intended for relatively simple SQL statement execution. Locks the DB file on every access, with
built-in retry mechanism.
Even though the DB is locked on every access, typically simple writes are much less than 1 second
(more like 1 mS), so this latency is still usable for many use cases.
```python
table_name = "example"
schema = {"id PRIMARY KEY": int, "name": str, "color": str, "year": int}
db_path = Path("temp", "example.sqlite")
db_path.parent.mkdir(exist_ok=True)
# Write and read data.
with MSQLite(db_path, table_name, schema) as db:
now = time.monotonic_ns() # some index value
# insert some data
db.execute(f"INSERT INTO {table_name} VALUES ({now}, 'plate', 'red', 2020), ({now + 1}, 'chair', 'green', 2019)")
# read the data back out
response = db.execute(f"SELECT * FROM {table_name}")
for row in response:
print(row)
# Read data out. No longer needs the schema.
with MSQLite(db_path, table_name) as db:
response = db.execute(f"SELECT * FROM {table_name}")
for row in response:
print(row)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "msqlite",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "sqlite, multithread, multiprocess",
"author": null,
"author_email": "James Abel <j@abel.co>",
"download_url": "https://files.pythonhosted.org/packages/f3/f2/485f1c5509fcc3a63dac2855c280df288152dd31397a81fde132e3b88235/msqlite-0.4.0.tar.gz",
"platform": null,
"description": "# msqlite\r\n\r\nMulti-threaded/multi-process support on top of SQLite. The intent is to ensure a SQL statement\r\nwill get executed, even if other threads or processes are trying to access the DB. Avoids \r\n`database is locked` issues. \r\n\r\nNo additional package dependencies beyond regular Python.\r\n\r\nIntended for relatively simple SQL statement execution. Locks the DB file on every access, with \r\nbuilt-in retry mechanism.\r\n\r\nEven though the DB is locked on every access, typically simple writes are much less than 1 second\r\n(more like 1 mS), so this latency is still usable for many use cases.\r\n\r\n```python\r\n table_name = \"example\"\r\n schema = {\"id PRIMARY KEY\": int, \"name\": str, \"color\": str, \"year\": int}\r\n db_path = Path(\"temp\", \"example.sqlite\")\r\n db_path.parent.mkdir(exist_ok=True)\r\n\r\n # Write and read data.\r\n with MSQLite(db_path, table_name, schema) as db:\r\n now = time.monotonic_ns() # some index value\r\n # insert some data\r\n db.execute(f\"INSERT INTO {table_name} VALUES ({now}, 'plate', 'red', 2020), ({now + 1}, 'chair', 'green', 2019)\")\r\n # read the data back out\r\n response = db.execute(f\"SELECT * FROM {table_name}\")\r\n for row in response:\r\n print(row)\r\n\r\n # Read data out. No longer needs the schema.\r\n with MSQLite(db_path, table_name) as db:\r\n response = db.execute(f\"SELECT * FROM {table_name}\")\r\n for row in response:\r\n print(row)\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 James Abel Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Execute simple SQLite statements that are multithreaded/multiprocess safe",
"version": "0.4.0",
"project_urls": {
"Source": "https://github.com/jamesabel/msqlite"
},
"split_keywords": [
"sqlite",
" multithread",
" multiprocess"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "942d6ed2299d53ce5f13dbc729c76018b8d188cac7c5d783bd0cbe77bc321d64",
"md5": "39ff8c6c8226f8aa1f569d1cd28da459",
"sha256": "97eeabd84d3dcdfa4d698a097fe72d44cd65e917dc1007fd79274bd6f89f930b"
},
"downloads": -1,
"filename": "msqlite-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "39ff8c6c8226f8aa1f569d1cd28da459",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5755,
"upload_time": "2024-05-17T03:39:35",
"upload_time_iso_8601": "2024-05-17T03:39:35.796083Z",
"url": "https://files.pythonhosted.org/packages/94/2d/6ed2299d53ce5f13dbc729c76018b8d188cac7c5d783bd0cbe77bc321d64/msqlite-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f3f2485f1c5509fcc3a63dac2855c280df288152dd31397a81fde132e3b88235",
"md5": "16fbf1c9e094470474bfcf80e2f2cf8b",
"sha256": "a51d948a4a1cf2c9c7b9617e537cb3d5b1a0b5b875a20f3aa955871287a81290"
},
"downloads": -1,
"filename": "msqlite-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "16fbf1c9e094470474bfcf80e2f2cf8b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4805,
"upload_time": "2024-05-17T03:39:37",
"upload_time_iso_8601": "2024-05-17T03:39:37.493798Z",
"url": "https://files.pythonhosted.org/packages/f3/f2/485f1c5509fcc3a63dac2855c280df288152dd31397a81fde132e3b88235/msqlite-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 03:39:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jamesabel",
"github_project": "msqlite",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "msqlite"
}