Python SQLite Client and Server
Project description
sqlite_rx
Official Documentation -> https://aosingh.github.io/sqlite_rx/
Introduction
SQLite 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 database built using ZeroMQ as the transport layer and msgpack for serialization/deserialization.
- Authentication using ZeroMQ Authentication Protocol (ZAP)
- Encryption using CurveZMQ
- Generic authorization policy during server startup
- Schedule regular backups for on-disk databases
Install
pip install -U sqlite_rx
Supported OS
- Linux
- MacOS
- Windows
Supported Python Platforms
- CPython 3.6, 3.7, 3.8, 3.9
- PyPy3.6
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.
# 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.
# 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)
>> python client.py
{'error': None, 'items': []}
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
Built Distribution
Hashes for sqlite_rx-1.1.0rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61cb55568eaa2d90a0da4419b56246e30b284d70c69296a93a0cf0ed89c2d9d9 |
|
MD5 | fc2e24ef613764efcee8227da965204b |
|
BLAKE2b-256 | e82b33f4313f22bf7db9e5a00e22e825a7aa50528dc52167a40edb68993c97a9 |