Titan DB — Python Client
Zero-setup distributed SQLite. Install with pip, start a fault-tolerant cluster with one command.
Install
pip install titan-db
Start the Server (One Command!)
titan-server start
This automatically:
- Downloads the correct
titan-nodebinary for your OS (Windows/Mac/Linux) - Starts a 3-node distributed cluster on localhost
- Prints the connection URLs
To stop the cluster:
titan-server stop
To check health:
titan-server status
Use the Client
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 — automatically finds and routes to the Leader node
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')")
# Read — queries any reachable node
rows = db.query("SELECT * FROM users")
print(rows)
# [{'id': '1', 'name': 'Alice', 'email': 'alice@example.com'}]
# Transactions — multiple statements, atomic
db.transaction([
"INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com')",
"INSERT INTO users (name, email) VALUES ('Charlie', 'charlie@example.com')",
])
# Cluster health
print(db.status())
print(db.leader())
Start the Server from Python
You can also manage the cluster programmatically:
from titan_db.server import TitanServer
from titan_db import TitanClient
# Use as a context manager — auto starts and stops
with TitanServer() as server:
db = TitanClient(server.node_urls())
db.execute("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)")
db.execute("INSERT INTO test (value) VALUES ('hello distributed world!')")
print(db.query("SELECT * FROM test"))
# Cluster automatically stops when the block exits
Authentication
If the server is started with TITAN_API_KEY, pass it to the client:
db = TitanClient(
nodes=["http://127.0.0.1:8001", "http://127.0.0.1:8002", "http://127.0.0.1:8003"],
api_key="my_secret_key"
)
API Reference
| Method | Description |
|---|---|
execute(sql) |
Write SQL — auto-routes to Leader via Raft |
query(sql) |
Read SQL — returns list of dicts |
transaction([...]) |
Atomic multi-statement transaction |
status() |
All nodes health |
leader() |
Current leader info |
CLI Reference
| Command | Description |
|---|---|
titan-server start |
Download binary + start 3-node cluster |
titan-server stop |
Stop all running nodes |
titan-server status |
Check cluster health |
titan-server download |
Just download the binary (no start) |
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
No Titan nodes are reachable |
Cluster not running | Run titan-server start |
Nodes reachable but no Leader |
Election in progress | Wait 1-2 seconds, retry |
Binary not found for your platform |
No pre-built binary | Build from source (see error message) |
Unauthorized |
API key required | Pass api_key= to TitanClient |
Links
- Repository: github.com/Yogendra-sodha/titan-distributed-sqlite
- Dashboard: Open
http://127.0.0.1:8001/when the cluster is running
Metadata
Release files for titan-db 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| titan_db-0.3.4.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| titan_db-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / titan_db-0.3.4.tar.gz
| Download URL | titan_db-0.3.4.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c11a1ba5645df5b79a3a6106e85e4ae51b0198ea3d7c3a410f7629667314db8
|
|
BLAKE2b-256 checksum How to use checksums |
e7571e3166e9ed65a5a2c7bb90ba2f8bf67c65ec6b2b3cfd82080e2f93da936d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.
Transparency logRelease files / titan_db-0.3.4-py3-none-any.whl
| Download URL | titan_db-0.3.4-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ecc55e370944db384590028e62411533f83a3325da834a99f02baa7942127c33
|
|
BLAKE2b-256 checksum How to use checksums |
c21b69722630d5738e051f8110fab37d5f83f576458e6f19384faf0e26c8f5f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 27, 2026.
Transparency log