https://github.com/aosingh/sqlite_rx
Python Client and Server for SQLite database with Docker support
https://github.com/aosingh/sqlite_rx
encryption python3 remote-execution secure sqlite-client sqlite-server sqlite3
Last synced: 4 months ago
JSON representation
Python Client and Server for SQLite database with Docker support
- Host: GitHub
- URL: https://github.com/aosingh/sqlite_rx
- Owner: aosingh
- License: mit
- Created: 2019-09-29T21:52:37.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-09-02T05:38:29.000Z (5 months ago)
- Last Synced: 2025-09-02T07:22:05.776Z (5 months ago)
- Topics: encryption, python3, remote-execution, secure, sqlite-client, sqlite-server, sqlite3
- Language: Python
- Homepage: https://aosingh.github.io/sqlite_rx
- Size: 221 KB
- Stars: 37
- Watchers: 2
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sqlite_rx
[](https://pypi.python.org/pypi/sqlite-rx) [](https://github.com/aosingh/sqlite_rx/actions) [](https://pepy.tech/project/sqlite-rx)
[](https://www.python.org/downloads/release/python-380/)
[]((https://www.python.org/downloads/release/python-390/))
[](https://www.python.org/downloads/release/python-3100/)
[](https://www.python.org/downloads/release/python-3110/)
[](https://www.python.org/downloads/release/python-3120/)
[](https://www.pypy.org/download.html)
[](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': []}
```