# sqlite_rx
[![PyPI version](https://badge.fury.io/py/sqlite-rx.svg)](https://pypi.python.org/pypi/sqlite-rx) [![sqlite-rx](https://github.com/aosingh/sqlite_rx/actions/workflows/sqlite_build.yaml/badge.svg)](https://github.com/aosingh/sqlite_rx/actions) [![Downloads](https://pepy.tech/badge/sqlite-rx)](https://pepy.tech/project/sqlite-rx)
[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)
[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)]((https://www.python.org/downloads/release/python-390/))
[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/)
[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/)
[![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)
[![PyPy3.8](https://img.shields.io/badge/python-PyPy3.8-blue.svg)](https://www.pypy.org/download.html)
[![PyPy3.9](https://img.shields.io/badge/python-PyPy3.9-blue.svg)](https://www.pypy.org/download.html)
#### For documentation, usage and examples refer [https://aosingh.github.io/sqlite_rx/](https://aosingh.github.io/sqlite_rx/)
# Introduction
[SQLite](https://www.sqlite.org/index.html) is a lightweight database written in C.
Python has in-built support to interact with the database (locally) which is either stored on disk or in memory.
With `sqlite_rx`, clients should be able to communicate with an `SQLiteServer` in a fast, simple and secure manner and execute queries remotely.
Key Features
- Client and Server for [SQLite](https://www.sqlite.org/index.html) database built using [ZeroMQ](http://zguide.zeromq.org/page:all) as the transport layer and [msgpack](https://msgpack.org/index.html) for serialization/deserialization.
- Authentication using [ZeroMQ Authentication Protocol (ZAP)](https://rfc.zeromq.org/spec:27/ZAP/)
- Encryption using [CurveZMQ](http://curvezmq.org/)
- Generic authorization policy during server startup
- Schedule regular backups for on-disk databases
# Install
```commandline
pip install -U sqlite_rx
```
# Server
`SQLiteServer` runs in a single thread and follows an event-driven concurrency model (using `tornado's` event loop) which minimizes the cost of concurrent client connections. Following snippet shows how you can start the server process.
```python
# server.py
from sqlite_rx.server import SQLiteServer
def main():
# database is a path-like object giving the pathname
# of the database file to be opened.
# You can use ":memory:" to open a database connection to a database
# that resides in RAM instead of on disk
server = SQLiteServer(database=":memory:",
bind_address="tcp://127.0.0.1:5000")
server.start()
server.join()
if __name__ == '__main__':
main()
```
# Client
The following snippet shows how you can instantiate an `SQLiteClient` and execute a simple `CREATE TABLE` query.
```python
# client.py
from sqlite_rx.client import SQLiteClient
client = SQLiteClient(connect_address="tcp://127.0.0.1:5000")
with client:
query = "CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)"
result = client.execute(query)
```
```text
>> python client.py
{'error': None, 'items': []}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/aosingh/sqlite_rx",
"name": "sqlite-rx",
"maintainer": "Abhishek Singh",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "abhishek.singh20141@gmail.com",
"keywords": "sqlite client server fast secure",
"author": "Abhishek Singh",
"author_email": "abhishek.singh20141@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/58/ea/0f4e250a4ba2e76da6975904043691fdec24c54f5b8c8dd9b85d75a14821/sqlite_rx-1.2.2.tar.gz",
"platform": null,
"description": "# sqlite_rx \n[![PyPI version](https://badge.fury.io/py/sqlite-rx.svg)](https://pypi.python.org/pypi/sqlite-rx) [![sqlite-rx](https://github.com/aosingh/sqlite_rx/actions/workflows/sqlite_build.yaml/badge.svg)](https://github.com/aosingh/sqlite_rx/actions) [![Downloads](https://pepy.tech/badge/sqlite-rx)](https://pepy.tech/project/sqlite-rx)\n\n\n[![Python 3.8](https://img.shields.io/badge/python-3.8-blue.svg)](https://www.python.org/downloads/release/python-380/)\n[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)]((https://www.python.org/downloads/release/python-390/))\n[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/)\n[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/)\n[![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/)\n\n\n[![PyPy3.8](https://img.shields.io/badge/python-PyPy3.8-blue.svg)](https://www.pypy.org/download.html)\n[![PyPy3.9](https://img.shields.io/badge/python-PyPy3.9-blue.svg)](https://www.pypy.org/download.html)\n\n\n#### For documentation, usage and examples refer [https://aosingh.github.io/sqlite_rx/](https://aosingh.github.io/sqlite_rx/)\n\n# Introduction\n\n[SQLite](https://www.sqlite.org/index.html) is a lightweight database written in C. \nPython has in-built support to interact with the database (locally) which is either stored on disk or in memory.\n\nWith `sqlite_rx`, clients should be able to communicate with an `SQLiteServer` in a fast, simple and secure manner and execute queries remotely.\n\nKey Features\n\n- Client and Server for [SQLite](https://www.sqlite.org/index.html) database built using [ZeroMQ](http://zguide.zeromq.org/page:all) as the transport layer and [msgpack](https://msgpack.org/index.html) for serialization/deserialization.\n- Authentication using [ZeroMQ Authentication Protocol (ZAP)](https://rfc.zeromq.org/spec:27/ZAP/)\n- Encryption using [CurveZMQ](http://curvezmq.org/)\n- Generic authorization policy during server startup\n- Schedule regular backups for on-disk databases\n\n# Install\n\n```commandline\npip install -U sqlite_rx\n```\n\n# Server\n\n`SQLiteServer` runs in a single thread and follows an event-driven concurrency model (using `tornado's` event loop) which minimizes the cost of concurrent client connections. Following snippet shows how you can start the server process.\n\n```python\n# server.py\n\nfrom sqlite_rx.server import SQLiteServer\n\ndef main():\n\n # database is a path-like object giving the pathname \n # of the database file to be opened. \n \n # You can use \":memory:\" to open a database connection to a database \n # that resides in RAM instead of on disk\n\n server = SQLiteServer(database=\":memory:\",\n bind_address=\"tcp://127.0.0.1:5000\")\n server.start()\n server.join()\n\nif __name__ == '__main__':\n main()\n\n```\n\n# Client\n\nThe following snippet shows how you can instantiate an `SQLiteClient` and execute a simple `CREATE TABLE` query.\n\n```python\n# client.py\n\nfrom sqlite_rx.client import SQLiteClient\n\nclient = SQLiteClient(connect_address=\"tcp://127.0.0.1:5000\")\n\nwith client:\n query = \"CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)\"\n result = client.execute(query)\n\n```\n\n```text\n>> python client.py\n\n{'error': None, 'items': []}\n```\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Python SQLite Client and Server",
"version": "1.2.2",
"project_urls": {
"Bug Tracker": "https://github.com/aosingh/sqlite_rx/issues",
"CI": "https://github.com/aosingh/sqlite_rx/actions",
"Documentation": "https://aosingh.github.io/sqlite_rx/",
"Homepage": "https://github.com/aosingh/sqlite_rx",
"License": "https://github.com/aosingh/sqlite_rx/blob/master/LICENSE",
"Release Notes": "https://github.com/aosingh/sqlite_rx/releases",
"Source": "https://github.com/aosingh/sqlite_rx"
},
"split_keywords": [
"sqlite",
"client",
"server",
"fast",
"secure"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e7155578d45a491365a32af885ff1a54ed59dfb247bb3dc4bfb63e8809bc46ff",
"md5": "81379b54326b3e60ae351a30ea52663c",
"sha256": "99d856e7f6fb85a93b96ddfc8b4a3395b5b3c983d75bb5f898b3415611edd1dc"
},
"downloads": -1,
"filename": "sqlite_rx-1.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81379b54326b3e60ae351a30ea52663c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 28232,
"upload_time": "2024-11-25T02:14:51",
"upload_time_iso_8601": "2024-11-25T02:14:51.299556Z",
"url": "https://files.pythonhosted.org/packages/e7/15/5578d45a491365a32af885ff1a54ed59dfb247bb3dc4bfb63e8809bc46ff/sqlite_rx-1.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "58ea0f4e250a4ba2e76da6975904043691fdec24c54f5b8c8dd9b85d75a14821",
"md5": "b4bdd29491ce4cf9a93ef46bc0e325a1",
"sha256": "141309b96f2c322941dee3d37359051bc8c3e07781a8c588c77e1dabf085f06a"
},
"downloads": -1,
"filename": "sqlite_rx-1.2.2.tar.gz",
"has_sig": false,
"md5_digest": "b4bdd29491ce4cf9a93ef46bc0e325a1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 21160,
"upload_time": "2024-11-25T02:14:52",
"upload_time_iso_8601": "2024-11-25T02:14:52.398467Z",
"url": "https://files.pythonhosted.org/packages/58/ea/0f4e250a4ba2e76da6975904043691fdec24c54f5b8c8dd9b85d75a14821/sqlite_rx-1.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 02:14:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aosingh",
"github_project": "sqlite_rx",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "billiard",
"specs": [
[
"==",
"4.2.1"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "msgpack",
"specs": [
[
"==",
"1.1.0"
]
]
},
{
"name": "pyzmq",
"specs": [
[
"==",
"26.2.0"
]
]
},
{
"name": "tornado",
"specs": [
[
"==",
"6.4.2"
]
]
}
],
"lcname": "sqlite-rx"
}