@livendb/liven-client (Python)
Python client SDK for LivenDB
from liven_py import LivenClient, Pipeline, Filter
client = LivenClient.connect("127.0.0.1:43121")
client.insert("users", "u1", {"name": "Alice", "role": "admin"})
user = client.get("users", "u1")
print(user[0].field("name"))
# → Alice
results = client.run(
Pipeline.from_stream("users")
.filter(Filter.field("role").eq("admin"))
.limit(10)
)
client.close()
Installation
pip install liven-client
Requires Python 3.9+.
Quick Start
1. Connect
from liven_py import LivenClient
# Default port is 43121
client = LivenClient.connect("localhost")
# With authentication key
client = LivenClient.connect("localhost:43121?auth_key=your-api-key")
2. CRUD Operations
# Insert
client.insert("events", "e1", {"type": "click", "value": 42})
# Upsert (insert or replace)
client.upsert("events", "e1", {"type": "click", "value": 99})
# Update (merge)
client.update("users", "u1", {"last_login": 1234567890})
# Get by key
record = client.get("users", "u1")
# Delete
client.delete("events", "e1")
# Clear all records from a stream
client.clear("sessions")
# Drop an entire stream
client.drop_stream("old_data")
3. Batch Operations
client.insert_many("events", [
("e1", {"type": "click"}),
("e2", {"type": "view"}),
])
4. Pipeline Queries
from liven_py import Pipeline, Filter
results = client.run(
Pipeline.from_stream("orders")
.filter(Filter.field("amount").gte(100))
.filter(Filter.field("status").eq("completed"))
.sort("amount", descending=True)
.limit(10)
)
5. Shorthand Pipeline Methods
client.filter("events", Filter.field("type").eq("click"))
client.limit("events", 50)
client.count("events")
client.sort("orders", "total", descending=True)
client.page("events", 1, 25)
client.page_cursor("feed", "cursor_abc", 25)
client.map("users", ["name", "email"])
client.window("pageviews", 60000, "count")
client.group("events", "type", ["count", "sum(value)"])
client.distinct("visitors", "ip_address")
client.vector_filter("documents", "embedding", [1, 0, -1], 0.75)
6. Joins
client.enrich("orders", "users", "user_id")
client.correlate("events", "sessions", "session_id", 5000)
client.chain("reviews", "orders", "order_id")
client.sequence("events", [
Filter.field("type").eq("login"),
Filter.field("type").eq("purchase"),
], 300000)
7. Pipeline Mutations
client.run_update(
Pipeline.from_stream("events").filter(Filter.field("status").eq("pending")),
{"status": "processed"}
)
client.run_delete(
Pipeline.from_stream("events").filter(Filter.field("type").eq("temp"))
)
8. Live Subscriptions
client.run_listen(
Pipeline.from_stream("alerts").filter(Filter.field("priority").eq("critical"))
)
9. Metadata
streams = client.streams()
status = client.status()
10. Raw DSL
results = client.query('from("users") | count()')
Development
# Install dependencies
pip install -e .
# Run the demo
python examples/demo.py
python examples/demo.py --key your-api-key
# Run tests
python -m pytest
License
MIT
Metadata
Release files for liven-client 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| liven_client-0.0.3.tar.gz | 11.0 kB | Without provenance | Details for liven_client-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| liven_client-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for liven_client-0.0.3-py3-none-any.whl |
Total release size: 23.6 kB
Release files / liven_client-0.0.3.tar.gz
| Download URL | liven_client-0.0.3.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5248e46605908ae33464b0c26300940c44ea454dd07207727ba8151b0d59e23
|
|
BLAKE2b-256 checksum How to use checksums |
50e55733cf8839d99d8739e760b5cebeb56661ae2c61b89fbd8d5b4baa29448b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / liven_client-0.0.3-py3-none-any.whl
| Download URL | liven_client-0.0.3-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf3e0f6185caf156d5f612b2c7f96df2968c6b37a7623313fbb7c9cd59e1289a
|
|
BLAKE2b-256 checksum How to use checksums |
f67438f17d3e5183c25ee1d8f77d9415ca6e6db923fbed44e2931a64035c085c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for liven-client 0.0.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.