Skip to content

Python Client and Server for SQLite database with Docker support

License

Notifications You must be signed in to change notification settings

ospoco/sqlite_server

Repository files navigation

sqlite_rx

PyPI versionsqlite-rxDownloads

Python 3.8Python 3.9Python 3.10Python 3.11Python 3.12

PyPy3.8PyPy3.9

For documentation, usage and examples refer 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

Install

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.

# server.pyfromsqlite_rx.serverimportSQLiteServerdefmain(): # 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 diskserver=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.pyfromsqlite_rx.clientimportSQLiteClientclient=SQLiteClient(connect_address="tcp://127.0.0.1:5000") withclient: query="CREATE TABLE stocks (date text, trans text, symbol text, qty real, price real)"result=client.execute(query)
>> python client.py{'error': None, 'items': []} 

About

Python Client and Server for SQLite database with Docker support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python99.7%
  • Dockerfile0.3%