recommend_root_model
Find the root source model from which every requested column or metric is reachable and get join-qualified paths for querying; if none covers all, returns partial coverage for multi-stage queries.
Instructions
Recommend the root model (query source_model) for a set of
model.column / model.metric items, and give each item's
join-qualified reference path from that root.
Introspects the join graph and picks the model from which every
requested item is reachable (LEFT joins are directional; INNER
joins traverse both ways), minimizing total join hops. The returned
paths are ready to drop into a query whose source_model is the
recommended root — e.g. a joined column comes back as
customers.regions.name and a root-owned one as status;
aggregation suffixes (:sum) are preserved.
When no single model reaches everything, root_model is null and
coverage lists the best partial roots so you can split the
request into a multi-stage query.
Args:
items: entity references (orders.revenue, customers.name,
orders.revenue:sum, bare aov for a saved metric...).
data_source: optional datasource scope; when omitted, names
resolve via the datasource-priority list. All items must
resolve to a single datasource.
root_hint: optional intended root — a bare model name or
<data_source>.<model> within the resolved datasource.
Honored when it reaches every item (overriding the min-hops
pick, so you can force a bridge model that owns none of the
items); otherwise the auto-pick is used and a warning
explains why. Resolved after the datasource is determined,
so it cannot pick the datasource.
format: "markdown" (default) or "json".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | ||
| format | No | markdown | |
| root_hint | No | ||
| data_source | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |