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 serve process. 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:9090
from 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: null in the audit log; set it once on the client and every query, ingest, and MCP call is tagged. Governance travels in the substrate.


Recipes

#RecipeWhat you'll learn
1Connect & Verifyhealth · status · ready · version · stats · list_modules
2Schema Managementregister_type · list_types · type_detail · schema_alter · deregister_type
3Ingest Databulk NDJSON · JSON upsert/skip · CSV · document
4SQL QueriesSELECT · aggregates · query_params · Arrow · multi_search · GraphQL · SPARQL
5Hybrid SearchHYBRID_SEARCH · POST /search · WEIGHTS · facets
6Identity Resolutiondetect · resolve · cluster · same · fuse · split
7Graph Analyticsshortest path · traverse · PageRank · community · SCC · link predict
8Investigation Toolssanctions · beneficial ownership · crypto · wire · hawala · geofence · maritime
9Agent Memoryremember · recall · justify · consolidate · forget · recognise · episodes · summarise
10MCP Tools (69)knowledge · entities · case · identity · NL→SQL · rules · workflows · RAG
11Media & Biometricsface search · similar image · PDQ match · DNS-tunnel detect
12Governance & ComplianceGDPR erase · sessions · export · enrichment rules · ontology migrate
13Branches & Namespacescreate/delete branch · schemaless namespace query/write
14System & Cluster Opscluster nodes/topology/rebalance/drain · SSE · webhooks · Flight · gRPC
15Audit & Provenanceaudit count/entries · proof · court-grade PDF · signed receipts
16Temporal QueriesAS 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.


The DIY alternative (for contrast)

ComponentDIY stackRelataDB
Relational storePostgres✅ built-in
Full-text searchElasticsearch / Typesense✅ custom BM25 (WAND, 12-language stemmers)
Vector storePinecone / pgvector✅ custom HNSW + DiskANN
Graph databaseNeo4j✅ CSR + PLL
Memory layermem0 / custom✅ 15 methods, governed
Audit logSplunk / custom✅ hash-chained, tamper-evident
Identity resolutionCustom ETL✅ SmartIngest (76 types)
Agent toolsCustom MCP server✅ 69 tools, governed
ETL glueKafka / Fivetran✅ not needed (one store)
Total services8+1

Every captured response on these pages was taken from a live RelataDB server. No mockups.