-
Notifications
You must be signed in to change notification settings - Fork 0
clients_python_sdk
Stand: 5. Dezember 2025
Version: 1.0.0
Kategorie: Clients
Stand: 10. November 2025
Dieses Dokument fasst die wichtigsten Schritte zusammen, um die Python-Clientbibliothek gegen eine ThemisDB-Instanz zu verwenden. Die SDK befindet sich noch im Alpha-Status (themis.__version__ == "0.1.0a0"). Breaking Changes sind jederzeit möglich.
- Python ≥ 3.11
- Laufende ThemisDB-Instanz (lokal oder Remote, z. B. via
docker-compose) - Zugriff auf mindestens einen HTTP-Endpunkt der Cluster-Knoten (z. B.
http://127.0.0.1:8765) - Optional: Zugriff auf den Metadaten-Service (z. B. etcd), falls der Topology-Endpunkt nicht über die Knoten selbst erreichbar ist
| Ziel | Befehl |
|---|---|
| Entwicklung im Repo | pip install -e clients/python |
| Reine Nutzung (z. B. CI) |
pip install clients/python (lokales Artefakt; Veröffentlichung in Paketindex steht noch aus) |
Stellen Sie sicher, dass die Abhängigkeit httpx>=0.26 verfügbar ist (wird über pyproject.toml installiert).
from themis import ThemisClient
client = ThemisClient(
endpoints=["http://127.0.0.1:8765"],
namespace="default",
metadata_endpoint="/_admin/cluster/topology", # optional: vollständige URL möglich
)
print(client.health()) # {'status': 'healthy', 'version': '0.1.0', ...}
client.close()| Parameter | Beschreibung |
|---|---|
endpoints |
Liste von HTTP-Basen (z. B. http://shard-1:8080) – dient als Bootstrap für Requests. |
metadata_endpoint |
Relative Pfadangabe (Default /_admin/cluster/topology) oder vollständige URL zu etcd/Consul. Bei Fehlschlag erfolgt ein Fallback auf die initiale Endpunktliste. |
timeout |
HTTP Timeouts in Sekunden (Default 30 s). |
max_retries |
Anzahl der Retries für 5xx-Fehler (Default 3). |
max_workers |
Obergrenze für parallele Batch-Requests (Default min(4, Anzahl Tasks)). |
Der Client lädt beim ersten Request die Shard-Topologie. Ist weder ein Pfad noch eine vollständige URL verfügbar, wird mit der Bootstrap-Liste weitergearbeitet. Fehler im Topologie-Fetch lösen TopologyError aus.
user_id = "550e8400-e29b-41d4-a716-446655440000"
client.put("relational", "users", user_id, {"name": "Alice"})
user = client.get("relational", "users", user_id)
client.delete("relational", "users", user_id)
batch = client.batch_get("relational", "users", ["1", "2", "999"])
print(batch.found) # {'1': {...}, '2': {...}}
print(batch.missing) # ['999']
print(batch.errors) # {} oder Fehler pro UUID
client.batch_put("relational", "users", {
"1": {"name": "Alice"},
"2": {"name": "Bob"},
})Hinweis: Bei Verwendung eines httpx.MockTransport (Tests) schaltet das SDK automatisch auf sequenzielle Batch-Verarbeitung um, um parallele Aufrufe innerhalb des Mocks zu vermeiden.
page = client.query(
"FOR u IN users RETURN u",
use_cursor=True,
batch_size=100,
)
while page.has_more:
page = client.query(
"FOR u IN users RETURN u",
use_cursor=True,
cursor=page.next_cursor,
)Das SDK erkennt automatisch, ob die Query URN-basiert ist (urn:themis:) und damit in einen Single-Shard-Plan fällt. Ansonsten erfolgt Scatter-Gather über alle bekannten Endpunkte. Die Rückgabe QueryResult enthält sowohl legacy- (entities) als auch Cursor-Felder (items, has_more, next_cursor).
-
health()→/health(Status, Version, Laufzeit) -
graph_traverse()→/graph/traverse -
vector_search()→/vector/search(unterstütztcursor&use_cursor)
- Topologieprobleme →
TopologyError - HTTP-Fehler ≥ 400 →
httpx.HTTPStatusError - Netzwerkausfälle → Exceptions aus
httpx
Empfohlen: Aufrufer fangen TopologyError, um ggf. Retry-Logik oder alternative Endpunkte zu verwenden.
pytest clients/python/testsDie Tests verwenden httpx.MockTransport, um Topologie-Fetch, Batch-Fallbacks und Cursor-Flows abzudecken. Integrationstests gegen docker-compose sind vorgesehen, sobald die API-Stabilität erreicht ist.
- Verpackung & Release-Prozess (z. B.
build/twinePipeline) - Authentifizierungs- und Secrets-Management
- Cursor-Pagination für COLLECT/Cursor-Routen, sobald Server-Seite verfügbar
- Beispiel-Notebooks & CLI-Wrapper
ThemisDB v1.3.4 | GitHub | Documentation | Discussions | License
Last synced: January 02, 2026 | Commit: 6add659
Version: 1.3.0 | Stand: Dezember 2025
- Übersicht
- Home
- Dokumentations-Index
- Quick Reference
- Sachstandsbericht 2025
- Features
- Roadmap
- Ecosystem Overview
- Strategische Übersicht
- Geo/Relational Storage
- RocksDB Storage
- MVCC Design
- Transaktionen
- Time-Series
- Memory Tuning
- Chain of Thought Storage
- Query Engine & AQL
- AQL Syntax
- Explain & Profile
- Rekursive Pfadabfragen
- Temporale Graphen
- Zeitbereichs-Abfragen
- Semantischer Cache
- Hybrid Queries (Phase 1.5)
- AQL Hybrid Queries
- Hybrid Queries README
- Hybrid Query Benchmarks
- Subquery Quick Reference
- Subquery Implementation
- Content Pipeline
- Architektur-Details
- Ingestion
- JSON Ingestion Spec
- Enterprise Ingestion Interface
- Geo-Processor Design
- Image-Processor Design
- Hybrid Search Design
- Fulltext API
- Hybrid Fusion API
- Stemming
- Performance Tuning
- Migration Guide
- Future Work
- Pagination Benchmarks
- Enterprise README
- Scalability Features
- HTTP Client Pool
- Build Guide
- Implementation Status
- Final Report
- Integration Analysis
- Enterprise Strategy
- Verschlüsselungsstrategie
- Verschlüsselungsdeployment
- Spaltenverschlüsselung
- Encryption Next Steps
- Multi-Party Encryption
- Key Rotation Strategy
- Security Encryption Gap Analysis
- Audit Logging
- Audit & Retention
- Compliance Audit
- Compliance
- Extended Compliance Features
- Governance-Strategie
- Compliance-Integration
- Governance Usage
- Security/Compliance Review
- Threat Model
- Security Hardening Guide
- Security Audit Checklist
- Security Audit Report
- Security Implementation
- Development README
- Code Quality Pipeline
- Developers Guide
- Cost Models
- Todo Liste
- Tool Todo
- Core Feature Todo
- Priorities
- Implementation Status
- Roadmap
- Future Work
- Next Steps Analysis
- AQL LET Implementation
- Development Audit
- Sprint Summary (2025-11-17)
- WAL Archiving
- Search Gap Analysis
- Source Documentation Plan
- Changefeed README
- Changefeed CMake Patch
- Changefeed OpenAPI
- Changefeed OpenAPI Auth
- Changefeed SSE Examples
- Changefeed Test Harness
- Changefeed Tests
- Dokumentations-Inventar
- Documentation Summary
- Documentation TODO
- Documentation Gap Analysis
- Documentation Consolidation
- Documentation Final Status
- Documentation Phase 3
- Documentation Cleanup Validation
- API
- Authentication
- Cache
- CDC
- Content
- Geo
- Governance
- Index
- LLM
- Query
- Security
- Server
- Storage
- Time Series
- Transaction
- Utils
Vollständige Dokumentation: https://makr-code.github.io/ThemisDB/