Skip to main content

schemabrain joins

Canonical joins are named, operator-blessed join paths between two entities. They give the agent a paste-ready ON clause via resolve_join instead of asking it to guess from foreign keys. The suggester is deterministic — FK constraints + pg_stat_statements evidence, no LLM, no cost cap.
Five actions: list, apply, suggest, export, export-all.

list

List canonical joins in the local store. The verification path after apply.

apply

Load canonical-join YAML file(s) or directory(ies) into the local store.

suggest

Mine FK constraints + pg_stat_statements query log to surface canonical join candidates. Deterministic — no LLM call, no API key, no cost cap.
One of these is required: For the suggester to pick up query-log evidence, the source database must have the pg_stat_statements extension installed and the role must have pg_read_all_stats (or be superuser). See Manual flow — Mine observed queries. Without it, the suggester falls back to FK-only ranking.

export

Render one canonical join from the local store as apply-ready YAML on stdout (or --out PATH).

export-all

Write one apply-ready YAML per canonical join into --dir.

Examples

Suggest → review → apply

One-shot suggest + apply for CI

Round-trip for version control


MCP tool — resolve_join

The agent-facing surface canonical joins feed into.

MCP tool — list_joins

The discovery path for confirmed joins.

schemabrain entities

Joins reference entity names — confirm entities first.

schemabrain mine-queries

Populates the query-log evidence the suggester reads from.