Skip to main content

DB-API 2.0 interface for LiteSync

Project description

LiteSync for Python3

This is a wrapper library to use LiteSync on Python 3

It is based on pysqlite3

Additional features: (compared to Python's sqlite3 module)

  • User-defined window functions (requires SQLite >= 3.25)
  • Flags and VFS an be specified when opening connection
  • Incremental BLOB I/O, bpo-24905
  • Improved error messages, bpo-16379
  • Simplified detection of DML statements via sqlite3_stmt_readonly.
  • Sqlite native backup API (also present in standard library 3.7 and newer).

Installation

You must install some LiteSync library for this one to work. It can be either pre-compiled binaries or you can compile it by yourself. You can start with the free version.

Installing with pip

pip install litesync

Cloning and Building

Optionally you can clone the repo and build it:

git clone --depth=1 https://gitlab.com/litesync/litesync-python3
cd litesync-python3
python3 setup.py build install

Usage

import litesync
import json
import time

conn = litesync.connect('file:app.db?node=secondary&connect=tcp://server:port')

# check if the db is ready
while True:
    result = conn.cursor().execute("PRAGMA sync_status").fetchone()
    status = json.loads(result[0])
    if status["db_is_ready"]: break
    time.sleep(0.250)

# now we can use the db connection
...

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

litesync-0.4.11.tar.gz (40.8 kB view hashes)

Uploaded Source

Built Distributions

litesync-0.4.11-cp312-cp312-win_amd64.whl (37.8 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

litesync-0.4.11-cp311-cp311-win_amd64.whl (37.5 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

litesync-0.4.11-cp310-cp310-macosx_10_9_universal2.whl (79.1 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

litesync-0.4.11-cp39-cp39-win_amd64.whl (37.6 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

litesync-0.4.11-cp38-cp38-win_amd64.whl (37.6 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

litesync-0.4.11-cp37-cp37m-win_amd64.whl (37.8 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

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