Adding a foreign key: linking entities together - Cloud - 7.3

Talend Studio User Guide

Version
Cloud
7.3
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development
Last publication date
2024-02-13
Available in...

Data Fabric

MDM Platform

Talend Studio enables you to set relationship between different entities using Foreign Keys.

Before you begin

You have already created data models, business entities and attributes in the data model. For further information, see Creating a data model, Creating business entities in a data model and Adding attributes to the business entity.

About this task

Consider as an example that your data model hold the following entities: Agency, Agent and Region. You want to link the two entities Agency and Region together in order to represent that an Agency belongs to a Region. Consequently, Agency will have a new attribute that points to a Region.

To set a foreign key, do the following:

Procedure

  1. Add a new Region attribute to the Agency entity as outlined in Adding attributes to the business entity.
  2. Right-click Region and select Set the Foreign Key from the list.
    Set the Foreign Key dialog box pops up.
  3. Click the three-dot button to open the Select Xpath dialog box.
  4. Browse to the Region primary key Id and then click Add in the bottom of the dialog box to proceed to the next step.
    The Xpath to the foreign key displays in the Set the Foreign Key dialog box.
  5. If you want to render the Foreign Key in the main tab, select the Render Foreign Key in the main tab? check box. By default, Talend MDM Web UI renders the Foreign Key in a separate tab.
  6. Click OK to close the dialog box.
    The foreign key is set to Region/Id under the Annotations node of the Region attribute in the data model editor.
    Entities which are linked by a foreign key are identified by a key icon with a green arrow . To jump directly to the related entity, right-click the entity in the data model editor and click Jump to Foreign Key Entity.