When working with a custom API Graph that supports only a flat structure of data, identifying relationships and foreign keys across relational data can be a bit challenging. However, Copilot can help you manage these relationships effectively.
In your case, where you have a one-to-many relationship between customers and their addresses, you would indeed need to create separate connectors or APIs for each entity. For example, you would have a Customer Connector/API and a CustomerAddresses Connector/API.
Copilot can automatically work out the relational data by recognizing the foreign key, such as customerId
, in the customer address records. This means that when you query the CustomerAddresses API, Copilot can identify the customerId
field and use it to link the addresses to the corresponding customer records.
To summarize:
- Create separate connectors/APIs for each entity (e.g., Customer and CustomerAddresses).
- Ensure that the foreign key (e.g.,
customerId
) is present in the related entity (e.g., CustomerAddresses). - Copilot will use the foreign key to establish the relationship between the entities and provide the combined data as needed.