Skip to main content

Python client for Titan Distributed SQLite

Project description

Titan DB — Python Client

Python client for Titan Distributed SQLite.

Install

pip install -e .

Or just copy titan_db.py into your project.

Usage

from titan_db import TitanClient

# Connect to the cluster
db = TitanClient([
    "http://127.0.0.1:8001",
    "http://127.0.0.1:8002",
    "http://127.0.0.1:8003",
])

# Write (auto-discovers and sends to the Leader)
db.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)")
db.execute("INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com')")
db.execute("INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com')")

# Read (goes to any reachable node)
rows = db.query("SELECT * FROM users")
for row in rows:
    print(row)
# {'id': '1', 'name': 'Alice', 'email': 'alice@example.com'}
# {'id': '2', 'name': 'Bob', 'email': 'bob@example.com'}

# Cluster status
print(db.status())
print(db.leader())

API

Method Description
execute(sql) Write SQL — auto-routes to Leader via Raft
query(sql) Read SQL — returns list of dicts
status() Get status of all nodes
leader() Get current leader info

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

titan_db-0.1.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

titan_db-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file titan_db-0.1.1.tar.gz.

File metadata

  • Download URL: titan_db-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for titan_db-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e8839f03fa442643e2a41072111f06d2a1d1d6c27dfee0017491ef6d2d3c8fc1
MD5 ec0c2de455afaf746603c2c80de5c747
BLAKE2b-256 fad6ec702bcb1c3e84ef01e5725ecb6faf57f4186ed568ca9f5edfb819e60936

See more details on using hashes here.

Provenance

The following attestation bundles were made for titan_db-0.1.1.tar.gz:

Publisher: pypi-publish.yml on Yogendra-sodha/titan-distributed-sqlite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file titan_db-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: titan_db-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for titan_db-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 625fff0578695b799e8c1c1be37e35dfafb207459a6c2de7d1b649fcf2f9730c
MD5 ee6a4090fa841741b65c3d30741b24cd
BLAKE2b-256 4ef09931dd8542c4f423c51c963be25e737d32d477adc98b4a9601b3545c34fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for titan_db-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yml on Yogendra-sodha/titan-distributed-sqlite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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