Skip to main content

synclite-logger (Python)

PyO3 bindings over the SyncLite Rust runtime. The Python API mirrors the Rust wrapper crate 1:1 — Connection, Statement, DuckDBConnection, DuckDBStatement, plus module-level initialize and await_sync — so Python samples read like the Rust examples in synclite-logger-rust/crates/synclite/examples/.

No DB-API adapter, no pre/post hooks, no separate user-DB connection. Python holds a Connection directly bound to the Rust type.

Build / install (editable, dev)

pip install maturin
maturin develop --release

This compiles crates/logger/bindings-python (cdylib _native) and installs the synclite package into the active environment.

Distribution wheels (per-platform)

synclite ships as platform-specific wheels — one per OS/arch — because the compiled _native extension links libduckdb natively; a single wheel cannot cover every platform. pip install synclite auto-selects the wheel matching the user's OS/arch. The full set is:

Platform Wheel tag Built by
Windows x64 win_amd64 host build (delvewheel repair)
Linux x86_64 manylinux_2_28_x86_64 Linux/WSL build (patchelf/auditwheel)
Linux aarch64 manylinux_2_28_aarch64 Linux/WSL build (patchelf/auditwheel)
macOS x86_64 / arm64 macosx_* macOS runner (delocate repair)

The repository build produces the host wheel automatically. The Linux manylinux wheels require bundling libduckdb.so + RPATH-patching via patchelf (POSIX-only, no Windows binary), so on Windows the Maven build dispatches them into WSL — see GETTING_STARTED.md → "Building Linux Python wheels". The complete cross-platform set (including macOS) is produced by CI (.github/workflows/python-wheels.yml).

Quickstart

import synclite as sl

sl.initialize(
    device_type="SQLITE",
    device_name="sampledevice",
    db_path="myapp.db",
    destination=sl.DestinationOptions(
        dst_type="POSTGRES",
        dst_connection_string="postgresql://user:pw@localhost:5432/syncdb",
        dst_database="syncdb",
        dst_schema="public",
    ),
)

conn = sl.Connection.open("myapp.db")
conn.execute("CREATE TABLE t(id INTEGER PRIMARY KEY, name TEXT)")

stmt = conn.prepare("INSERT INTO t(id, name) VALUES(?, ?)")
stmt.execute([1, "Alice"])
stmt.add_batch([2, "Bob"])
stmt.add_batch([3, "Carol"])
stmt.execute_batch()

for row in conn.query("SELECT id, name FROM t ORDER BY id"):
    print(row)

conn.commit()
conn.flush()
sl.await_sync("myapp.db", 30.0)
conn.close()

For DuckDB, swap Connection for DuckDBConnection and device_type="DUCKDB". For STORE / STREAMING devices, write a config file with device-type=SQLITE_STORE or STREAMING and open with Connection.open_with_config(path).

See synclite-code-samples/synclite-logger/python/ for runnable samples — each one is a 1:1 mirror of the corresponding Rust example.

Parameter / row conversion

Python Rust Value
None Value::Null
bool Value::Int(0/1)
int Value::Int
float Value::Real
str Value::Text
bytes Value::Blob

query(...) returns list[tuple] using the same mapping in reverse.

Pass parameters as a list or tuple; pass nothing (or None) for parameterless statements.

API surface

  • initialize(device_type, device_name, db_path, destination=None, config_path=None)
  • await_sync(db_path, timeout_seconds)
  • DestinationOptions(dst_type, dst_connection_string, dst_database=None, dst_schema=None, dst_sync_mode="CONSOLIDATION")
  • Connection.open(path) / open_with_config(path) / initialize(path) / initialize_with_config(path)
  • Connection.execute(sql, params=None) -> int
  • Connection.query(sql, params=None) -> list[tuple]
  • Connection.prepare(sql) -> Statement
  • Connection.{commit,rollback,flush,close,set_auto_commit,get_auto_commit}
  • Statement.execute(params=None) -> int
  • Statement.query(params=None) -> list[tuple]
  • Statement.{add_batch,clear_batch,execute_batch}
  • DuckDBConnection / DuckDBStatement: identical shape.

device_type, dst_type, dst_sync_mode are accepted as case-insensitive strings:

  • device_type: "SQLITE", "SQLITE_STORE", "STREAMING", "DUCKDB", "DUCKDB_STORE"
  • dst_type: "SQLITE", "DUCKDB", "POSTGRES"
  • dst_sync_mode: "CONSOLIDATION", "REPLICATION"

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

synclite-1.1.0-cp38-abi3-win_amd64.whl (17.2 MB view details)

Uploaded CPython 3.8+Windows x86-64

synclite-1.1.0-cp38-abi3-manylinux_2_28_x86_64.whl (28.4 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ x86-64

synclite-1.1.0-cp38-abi3-manylinux_2_28_aarch64.whl (25.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.28+ ARM64

File details

Details for the file synclite-1.1.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: synclite-1.1.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 17.2 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for synclite-1.1.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c07df90d7466f620b193f732c157581edec961120c55dcefbc9982877fc98ba6
MD5 fb1dd065953cfedf2fc1c78fb77bd9c0
BLAKE2b-256 5572dfa2253cad4c151402f42af60febe9a8f74b13f7da5fecab49b8a5d123b8

See more details on using hashes here.

File details

Details for the file synclite-1.1.0-cp38-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for synclite-1.1.0-cp38-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 22fc404422bf66b08fba37de7f220f54418abacfdd7fd7dcef5b3ba3351fd8c4
MD5 775066d0698e3062f22d7454078092bf
BLAKE2b-256 2013d40877ec1f40abba9068f33cd340c25ea17d116b8fcb7f573fca70e60d5c

See more details on using hashes here.

File details

Details for the file synclite-1.1.0-cp38-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for synclite-1.1.0-cp38-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c319688297e502cd93f2056e886ef29b92311c13ca9f948a2a8ab0b2c8c0262c
MD5 f541980b440064705095e83f25414d59
BLAKE2b-256 8a0f512c56f1d5aabe38a385cf2c5f1cb72732739981b75c7e0d1d257d6dab85

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

3 files

1.0.0

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page