Context
Connect tables with joins
Each foreign key the database declares is a join from the start. On MySQL / MariaDB, Bonnard does not read foreign keys, so add those joins yourself. Changes wait in a draft until you publish it. To make sure that a change saved, review the draft.
Requirements
- The Editor role or higher in your workspace.
- To work from your AI client: Bonnard connected and access to the data source.
Add a join
Start from the table that holds the reference: refunds, for a join from refunds to orders. A join has up to 4 column pairs, and each pair must have matching types. The two tables must be different.
In your AI client
Ask:
In <data source>, add a join from <table> to <other table> on <table>.<column> = <other table>.<column>.
In the console
- In the console at
app.bonnard.ai, select Context, then Tables, then the table that holds the reference. With more than one data source, select one at the top right first. - Under Joins, select Add join.
- Under Joins to, select Pick a table, then the other table.
- Select a column on each side. For another pair, select + Add column.
- Select Add join. The join shows with the badge
edited.
These columns have different types. means that the pair cannot be joined.
The database already declares this join. means that the join exists.
Remove a join
AI clients keep a live join until you publish the draft. A join the database declares cannot be removed, so it is hidden from AI clients instead.
In your AI client
Ask:
In <data source>, remove the join from <table> to <other table>.
Bonnard removes a join in the live version only after the agent sends confirmed: true. The agent is told to ask you first. The same request hides a join the database declares. If the two tables join more than one way, name the
columns in the request.
In the console
- On either table’s page in Context, find the join under Joins.
- Select Remove. For a join with the badge
database, select Hide from AI clients.
Undo shows for 6 seconds after Remove. Show to AI clients brings back a hidden join.
Accept a suggested join
Bonnard suggests a join when a column named <name>_id matches a table named <name> or <name>s with a single-column
key or an id column. Agents do not get suggestions.
In the console
- On the table’s page in Context, find the join with the badge
Suggestedunder Joins. - Select Confirm to add it to the draft, or Dismiss to add the dismissal to the draft.
After you publish a dismissal, only a revert brings the suggestion back.
Related
- Describe your data: set keys and descriptions on the tables you joined.
- Define metrics: name a calculation over the joined tables.
- Publish context changes: review the draft and take it live.