Cookbook
Step-by-step recipes for every RelataDB capability. Each page is focused, copy-pasteable, and follows the same investigation — Operation Shadow Ledger, a $2.8 M embezzlement — as the connective tissue.
Every captured output on these pages is real — taken from a live
relata serveprocess. The scenario is fictional; the data shapes, query patterns, and governance are production-grade.
Setup
Every snippet below assumes this client is already built:
pip install relata-sdk httpx
relata serve # starts on localhost:9090from relata import (
RelataClient, IngestClient, Memory, McpClient,
AuditClient, Namespace, QueryResult,
)
client = RelataClient(
"http://localhost:9090",
bearer_token="perftoken",
purpose="analytics",
)PURPOSE is optional but never invisible. Omit it and the server records
purpose: nullin the audit log; set it once on the client and every query, ingest, and MCP call is tagged. Governance travels in the substrate.
Recipes
| # | Recipe | What you'll learn |
|---|---|---|
| 1 | Connect & Verify | health · status · ready · version · stats · list_modules |
| 2 | Schema Management | register_type · list_types · type_detail · schema_alter · deregister_type |
| 3 | Ingest Data | bulk NDJSON · JSON upsert/skip · CSV · document |
| 4 | SQL Queries | SELECT · aggregates · query_params · Arrow · multi_search · GraphQL · SPARQL |
| 5 | Hybrid Search | HYBRID_SEARCH · POST /search · WEIGHTS · facets |
| 6 | Identity Resolution | detect · resolve · cluster · same · fuse · split |
| 7 | Graph Analytics | shortest path · traverse · PageRank · community · SCC · link predict |
| 8 | Investigation Tools | sanctions · beneficial ownership · crypto · wire · hawala · geofence · maritime |
| 9 | Agent Memory | remember · recall · justify · consolidate · forget · recognise · episodes · summarise |
| 10 | MCP Tools (69) | knowledge · entities · case · identity · NL→SQL · rules · workflows · RAG |
| 11 | Media & Biometrics | face search · similar image · PDQ match · DNS-tunnel detect |
| 12 | Governance & Compliance | GDPR erase · sessions · export · enrichment rules · ontology migrate |
| 13 | Branches & Namespaces | create/delete branch · schemaless namespace query/write |
| 14 | System & Cluster Ops | cluster nodes/topology/rebalance/drain · SSE · webhooks · Flight · gRPC |
| 15 | Audit & Provenance | audit count/entries · proof · court-grade PDF · signed receipts |
| 16 | Temporal Queries | AS OF · AS OF SYSTEM TIME · WITH PROVENANCE |
Full Stories
Prefer the whole tour in one read? These two end-to-end cookbooks run every method through a single fictional investigation.
- 📖 Operation Shadow Ledger — Financial Crime & AML — the $2.8 M embezzlement investigation that exercises every
RelataClientmethod, the fullMemorysurface, and all 69 MCP tools. The source the recipes above were split from. - 🛡️ Operation Nightwatch — Cyber Security & SOC — EDR threat hunting: import Sigma rules, hunt lateral movement, correlate IOCs across hosts, trace each alert to its source with full provenance.
The DIY alternative (for contrast)
| Component | DIY stack | RelataDB |
|---|---|---|
| Relational store | Postgres | ✅ built-in |
| Full-text search | Elasticsearch / Typesense | ✅ custom BM25 (WAND, 12-language stemmers) |
| Vector store | Pinecone / pgvector | ✅ custom HNSW + DiskANN |
| Graph database | Neo4j | ✅ CSR + PLL |
| Memory layer | mem0 / custom | ✅ 15 methods, governed |
| Audit log | Splunk / custom | ✅ hash-chained, tamper-evident |
| Identity resolution | Custom ETL | ✅ SmartIngest (76 types) |
| Agent tools | Custom MCP server | ✅ 69 tools, governed |
| ETL glue | Kafka / Fivetran | ✅ not needed (one store) |
| Total services | 8+ | 1 |
Every captured response on these pages was taken from a live RelataDB server. No mockups.