add_template_relationship
Add a relationship between tables in a closed Power BI template (.pbit) by editing the DataModelSchema JSON directly, with validation and collision checks, no Power BI Desktop.
Instructions
Add a relationship to a closed .pbit template's model, editing the DataModelSchema JSON on disk with no Power BI Desktop. Both endpoints must exist (the tables and columns are validated). A fresh GUID name is generated. Collision-checked: fails if an identical from/to relationship already exists. Written back in place (with a .bak guard).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| toTable | Yes | the 'one' side table | |
| isActive | No | whether the relationship is active (default true) | |
| pbitPath | Yes | path to the closed .pbit template | |
| toColumn | Yes | the 'one' side column | |
| fromTable | Yes | the 'many' side table | |
| fromColumn | Yes | the 'many' side column | |
| crossFilteringBehavior | No | cross-filtering: oneDirection (default) or bothDirections (or automatic) |