TriCoreDB for Python
0.1.0The official Python client: SQL, documents, cache, vectors and graphs over one native connection.
Install
pip
pip install tricoredbRequirements
- Python 3.9 or later
- A TriCoreDB server, 0.1.0-rc.1 or later (install one)
Highlights
- Standard library only
- Fully typed, checked with mypy --strict
- Exact Decimal, datetime and UUID values
- Transactions, connection pool, TLS and mutual TLS
Quick start
main.py
import os
from tricoredb import TriCore
with TriCore.connect("127.0.0.1", 8427, user="admin", secret=os.environ["TRICORE_ADMIN_PASSWORD"]) as db:
db.execute("CREATE TABLE IF NOT EXISTS users (id INT PRIMARY KEY, name TEXT)")
db.execute("INSERT INTO users VALUES (?, ?)", [1, "Ada"])
rows = db.query("SELECT id, name FROM users WHERE id = ?", [1])
print(rows.dicts()) # [{'id': '1', 'name': 'Ada'}]TLS
This example connects without TLS, which matches the development container. The default image requires TLS. The README shows how to connect with a CA certificate, and documents every call.