Skip to main content

Python SQLite Client and Server

Project description

sqlite_rx

PyPI version sqlite-rx Downloads

Python 3.8 Python 3.9 Python 3.10 Python 3.11 Python 3.12

PyPy3.8 PyPy3.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.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlite_rx-1.2.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

sqlite_rx-1.2.1-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file sqlite_rx-1.2.1.tar.gz.

File metadata

  • Download URL: sqlite_rx-1.2.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for sqlite_rx-1.2.1.tar.gz
Algorithm Hash digest
SHA256 6ac1b482db931d1a016e2a793e4b0811dd7d9c8cca493afae6cef7b0ed6d1d42
MD5 6238f9732c41134c59967022f584b0a9
BLAKE2b-256 eb55f0f824cd5454d3157c48d1af6d02761c25d8e14ea412809582d3f9aa848a

See more details on using hashes here.

File details

Details for the file sqlite_rx-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: sqlite_rx-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for sqlite_rx-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c25d899a80bbd9395f7a01ea602686c424859e49e34fbab964e5de1fc90bd8b7
MD5 8c9a57c6a9fd23b2abd14f95cc4e972b
BLAKE2b-256 6cb1a87174ba865a4fb879d80f8f8273ee59d26023e02f15aaefa270987f384f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page