Skip to main content

Quickstart

Predict 90-day churn for every customer, as of July 1.

Declare the schema and wire callbacks over your own storage. If your data is in pandas, pandas remains an application dependency:

import pandas as pd
from relativedb import Engine, ExecutionInput, RetrieverWiring, Row

customer_rows = [Row("customers", r.customer_id, {"age": float(r.age)})
for r in customers.itertuples()]
by_id = {row.id: row for row in customer_rows}

def fetch_customers(table, ids, bound):
return [by_id[row_id] for row_id in ids if row_id in by_id]

wiring = (RetrieverWiring.new_wiring()
.entities("customers", fetch_customers)
.entities("orders", fetch_orders)
.default_links(fetch_order_children)
.scanner("customers", scan_customers)
.build())

result = Engine(schema, wiring).execute(ExecutionInput(
query="PREDICT NOT EXISTS(orders.*) OVER (90 DAYS FOLLOWING) FOR EACH customers.customer_id",
anchor_time=pd.Timestamp("2026-07-01").to_pydatetime()))

:::info No model required By default predictions come from a transparent, model-free history baseline — the full pipeline runs with zero model artifacts. Swap in the real RT-J model via the native backend. :::

Next steps