tMDMOutput
Writes data into or removes data from the MDM server.
tMDMOutput receives data from the
preceding component, generates an XML document, and then writes data in an MDM Hub using
an output field.
used to create the record even if the ID is set to be auto-generated in the data model. An
update operation will be performed if a record with the same ID already exists in MDM.
tMDMOutput Standard properties
These properties are used to configure tMDMOutput running in the Standard Job framework.
The Standard
tMDMOutput component belongs to the Talend MDM family.
The component in this framework is available in all Talend
products.
Basic settings
Property Type |
Either Built-in or Repository. |
||||||||
 |
Built-in: No property data stored |
||||||||
 |
Repository: Select the repository |
||||||||
Input Schema and Edit |
An input schema is a row description, it defines the number of Click Edit
Click Sync columns to collect the |
||||||||
 |
Built-in: You create the schema |
||||||||
 |
Repository: You have already |
||||||||
Build the document |
Select this check box if you want to build the document from a flat schema. If this is If the check box is not selected, you must select the column in |
||||||||
Result of the XML serialization |
Lists the name of the XML output column that will hold the XML |
||||||||
Use an existing connection |
Select this check box if you want to use a configured tMDMConnection component. |
||||||||
MDM version |
By default, Server 6.0 is |
||||||||
URL |
Type in the URL of the MDM server. |
||||||||
Username and |
Type in the user authentication data for the MDM server. To enter the password, click the […] button next to the Note:
Ensure that the user has been assigned a role in |
||||||||
Data Model |
Type in the name of the data model against which the data to be |
||||||||
Data Container |
Type in the name of the data container where you want to write the
master data. Note:
This data container must already exist. |
||||||||
Type |
Select Master or Staging to specify the database on which |
||||||||
Return Keys |
Columns corresponding to IDs in |
||||||||
Is Update |
Select this check box to update the modified fields. If you leave this check box unchecked, all fields will be |
||||||||
Fire a Create/Update event |
Select this check box to add the actions carried out to a Source Name: Between Enable verification by before saving Note: The insert/update operation will fail, without any indication, if the
Enable verification by before saving process check box is selected and the validation of the data record is not successful. For more information about the Before Saving process, see Talend Studio User Guide. |
||||||||
Add task id |
Select this check box to set an identifier for the task. The
|
||||||||
Use partial update |
Select this check box if you need to update multi-occurrence Once selected, you need to set the parameters presented – Pivot: type in the xpath to For example, if you need to add a child sub-element to the below
the Xpath you enter in this Pivot field must read as follows: /Person/Children/Child where the Overwrite check box is cleared. And, if you need to replace a child sub-element in an existing
the Xpath you enter in this Pivot field must read as follows: /Person/Addresses/Address where the Overwrite check box is selected, and the Key field is set to /Type .In such an example, assuming the item in MDM only has an – Overwrite: select this check – Key: type in the xpath –Position: type in a number to – Delete: select this check box For example, if you need to remove two houses from the existing
the Xpath you enter in this Pivot field must read as follows: /Person/Houses/House wherethe Delete check box is selected, and the Key field is set to . or empty.Moreover, you need to provide the source XML stream as follows:
In this case, the House [1] For more examples of the partial update operations, see Examples of partial update operations using tMDMOutput. |
||||||||
Die on error |
Select this check box to skip the row in error and complete the |
Advanced settings
Extended Output |
Select this check box to commit master data in batches. You can |
Configure Xml Tree |
Opens the interface which helps create the XML structure of the |
Group by |
Select the column to be used to regroup the master data. |
Create empty element if needed |
This check box is selected by default. If the content of the |
Advanced separator (for number) |
Select this check box to modify the number of separators used by
– Thousands separator: enter
– Decimal separator: enter between |
Generation mode |
Select the appropriate generation mode according to your memory
|
Encoding |
Select the encoding type from the list or else select Custom and define it manually. This is an |
tStatCatcher Statistics |
Select this check box to gather the processing metadata at the Job |
Global Variables
Global Variables |
ERROR_MESSAGE: the error message generated by the
NB_LINE: the number of rows processed. This is an After
NB_LINE_REJECTED: the number of rows rejected. This is an A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see |
Usage
Usage rule |
Use this component to write a data record and separate You can increase the timeout values for a Job using this component |
Examples of partial update operations using tMDMOutput
The section will demonstrate how to set the parameters in the component tMDMOutput to perform the partial update operations with
several examples.
Partial update with Overwrite enabled or disabled
The following two examples explain how to add some elements to an existing item
(entity) with multi-occurrence elements (attributes) and then update the newly added
elements based on the content of a source XML stream.
Given an existing item as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<Person> <Id>1</Id> <Name>p1</Name> <Houses> <House>[1]</House> <House>[2]</House> <House>[3]</House> </Houses> <Children> <Child> <Name>k1</Name> <Age>1</Age> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> </Child> </Children> <Person> |
Example 1: If you want to add two Child items to the existing item, then the Xpath you
enter in the Pivot field must read as follows:
/Person/Children/Child
where the Overwrite check box is cleared, and the Key field is set to /Name
. Note that the Child element is of complex type, and needs to be
identified with the Key field. Moreover, you need
to provide the source XML stream as follows:
1 2 3 4 5 6 7 8 9 10 11 |
<Person> <Id>1</Id> <Children> <Child> <Name>k2</Name> </Child> <Child> <Name>k3</Name> </Child> </Children> </Person> |
In this case, the two child items Child [k2]
and Child [k3] will be added, and you will get
the following result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<Person> <Id>1</Id> <Name>p1</Name> <Houses> <House>[1]</House> <House>[2]</House> <House>[3]</House> </Houses> <Children> <Child> <Name>k1</Name> <Age>1</Age> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> </Child> <Child> <Name>k2</Name> </Child> <Child> <Name>k3</Name> </Child> </Children> </Person> |
Example 2: If you want to change the names of the
two child items Child [k2] and Child [k3], then the Xpath you enter in the Pivot field must read as follows:
/Person/Children/Child
where the Overwrite check box is selected, and the Key field is set to /Name
. Moreover, you need to
provide the source XML stream as follows:
1 2 3 4 5 6 7 8 9 10 11 |
<Person> <Id>1</Id> <Children> <Child> <Name>Tina</Name> </Child> <Child> <Name>Tommy</Name> </Child> </Children> </Person> |
In this case, the names of the two child items Child
[k2] and Child [k3] will be
updated, and you will get the following result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<Person> <Id>1</Id> <Name>p1</Name> <Houses> <House>[1]</House> <House>[2]</House> <House>[3]</House> </Houses> <Children> <Child> <Name>k1</Name> <Age>1</Age> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> </Child> <Child> <Name>Tina</Name> </Child> <Child> <Name>Tommy</Name> </Child> </Children> </Person> |
Partial update with Delete enabled
The following examples show how to remove some elements from an existing item
(entity) with multi-occurrence elements (attributes) based on the content of a
source XML stream.
Given an existing item as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<Person> <Id>1</Id> <Name>p1</Name> <Houses> <House>[1]</House> <House>[2]</House> <House>[3]</House> </Houses> <Children> <Child> <Name>k1</Name> <Age>1</Age> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> </Child> <Child> <Name>k2</Name> <Age>2</Age> </Child> <Child> <Name>k3</Name> <Age>3</Age> </Child> </Children> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> <Pets> <Pet>Cat</Pet> </Pets> <Pets> <Pet>Dog</Pet> </Pets> <Pets> <Pet>Pig</Pet> </Pets> <Pets> <Pet>Cow</Pet> </Pets> </Person> |
Example 1: If you want to remove two child items
from the existing item, then the Xpath you enter in the Pivot field must read as follows:
/Person/Children/Child
where the Delete check box is selected, and the Key field is set to /Name
. Note that the Child element is of a complex type, and needs to be
identified with the Key field. Moreover, you need
to provide the source XML stream as follows:
1 2 3 4 5 6 7 8 9 10 11 |
<Person> <Id>1</Id> <Children> <Child> <Name>k2</Name> </Child> <Child> <Name>k3</Name> </Child> </Children> </Person> |
In this case, the two items Child [k2] and
Child [k3] will be removed, and you will get
the following result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<Person> <Id>1</Id> <Name>p1</Name> ... <Children> <Child> <Name>k1</Name> <Age>1</Age> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> </Child> </Children> ... </Person> |
Example 2: If you want to remove some habits for
the Person element, then the Xpath you enter in
the Pivot field must read as follows:
/Person/Habits/Habit
where the Delete check box is selected, and the Key field is set to .
or empty
. Moreover,
you need to provide the source XML stream as follows:
1 2 3 4 5 6 7 8 |
<Person> <Id>1</Id> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> <Habit>Boxing</Habit> </Habits> </Person> |
In this case, the three habit items Habit
[Basketball], Habit [Football] and
Habit [Boxing] will be removed, and you will
get the following result:
1 2 3 4 5 6 7 8 9 |
<Person> <Id>1</Id> <Name>p1</Name> ... <Habits> <Habit>Tennis</Habit> </Habits> ... </Person> |
Example 3: If you want to remove some habits for
the Child [k1] element, then the Xpath you enter
in the Pivot field must read as follows:
/Person/Children/Child[1]/Habits/Habit
where the Delete check box is selected, and the Key field is set to .
or empty
.
Note that Child[1] is used in the Pivot field to identify the habits of which child will be
removed. Moreover, you need to provide the source XML stream as follows:
1 2 3 4 5 6 7 8 9 10 11 |
<Person> <Id>1</Id> <Children> <Child> <Habits> <Habit>Basketball</Habit> <Habit>Football</Habit> </Habits> </Child> </Children> </Person> |
In this case, the two items Habit [Basketball]
and Habit [Football] will be removed, and you
will get the following result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<Person> <Id>1</Id> <Name>p1</Name> ... <Children> <Child> <Name>k1</Name> <Age>1</Age> <Habits> <Habit>Tennis</Habit> <Habit>Boxing</Habit> </Habits> </Child> <Child> <Name>k2</Name> <Age>2</Age> </Child> <Child> <Name>k3</Name> <Age>3</Age> </Child> </Children> ... </Person> |
Example 4: If you want to remove some pets for
the Person element, then the Xpath you enter in
the Pivot field must read as follows:
/Person/Pets
where the Delete
check box is selected, and the Key field is set to
/Pet
. Moreover, you need to provide the source XML stream as
follows:
1 2 3 4 5 6 7 8 9 |
<Person> <Id>1</Id> <Pets> <Pet>Cat</Pet> </Pets> <Pets> <Pet>Pig</Pet> </Pets> </Person> |
In this case, the two items Pet [Cat] and
Pet [Pig] will be removed, and you will get
the following result:
1 2 3 4 5 6 7 8 9 10 11 |
<Person> <Id>1</Id> <Name>p1</Name> ... <Pets> <Pet>Dog</Pet> </Pets> <Pets> <Pet>Cow</Pet> </Pets> </Person> |
Writing master data in an MDM hub
This scenario applies only to Talend MDM Platform and Talend Data Fabric.
This scenario describes a two-component Job that generates a data record,
transforms it into XML and loads it into the defined business entity in the MDM server.
In this example, we want to load a new agency in the Agency business entity. This new agency has an id, a name and three offices located
in different cities.
For more information about entities, see
Talend Studio User Guide.
Dropping and linking the components
-
From the Palette, drop tFixedFlowInput and tMDMOutput
onto the design workspace. -
Connect the components using a Row Main
link.
Configuring the components
Preparing the data to be loaded into the MDM server
-
Double-click tFixedFlowInput to view its
Basic settings in the Component tab. -
In the Schema list, select Built-In and then click the three-dot button next to
Edit schema to open a dialog box in which
you can define the structure of the master data you want to write on the MDM
server. -
Click the [+] button and add five columns of
the type String.In this example, name the columns Id,
Name, Office_R_and_D, Office_Sales, and
Office_Services. - Click OK to validate your changes.
-
In the Number of rows field, enter the number
of rows you want to generate. - In the Mode area, select the Use Single Table option.
-
In the Value fields, enter between quotes the
values which correspond to each of the schema columns.
Basic settings of tMDMOutput
-
In the design workspace, click tMDMOutput to open its Basic
settings view. -
In the Input Schema
list, select Built-In and then click the
[…] button next to the Edit Schema field to define the structure of the
master data you want to load into the MDM server.The tMDMOutput
component basically generates an XML document, writes it in an output field, and
then sends it to the MDM server. -
Click OK to proceed to
the next step.The Result of the XML
serialization list in the Basic
settings view is automatically filled in with the output xml column. -
In the URL field, enter
the URL to access the MDM server. -
In the Username and
Password fields, enter the
authentication information required to connect to the MDM server. -
In the Data Model field,
enter between quotes the name of the data model against which you want to
validate the master data you want to write. -
In the Data Container,
enter between quotes the name of the data container into which you want to write
the master data. -
Select the Is Update
checkbox if you only want to update some fields rather than the entire data
record.
Advanced settings of tMDMOutput
-
In the Component view, click Advanced settings to set the advanced parameters for
the tMDMOutput component. -
Select the Extended Output check box if you
want to commit master data in batches, and specify the number of lines per batch
in the Rows to commit field.Click the […] next to Configure XML Tree to open the tMDMOutput editor.Alternatively, double-click tMDMOutput to
open the editor. -
In the Link target area to the right, click
in the XML Tree field and then replace
rootTag with the name of the business
entity into which you want to insert the data record,
Agency in this example. -
In the Linker source area, select the two
schema columns Id and Name and drop them on the Agency node respectively.The Selection dialog box is
displayed.Select the Create as sub-element of target
node option so that the two columns are linked to the two XML
sub-elements of the Agency node. -
Right-click the root node Agency and then
select Add Sub-element.In the dialog box that pops up, enter a name for the new sub-element,
Offices in this example.Repeat the same procedure to create three new sub-elements Office for the Offices node which corresponds to the multi-occurence element
Offices of the business entity Agency. -
In the Linker source area, select the three
schema columns Office_R_and_D, Office_Sales and Office_Services and drop them on the three new Office nodes respectively.The Selection dialog box is
displayed.Select the Create as sub-element of target
node option so that the three columns are linked to the three XML
sub-elements of the Offices node. - Click Ok to proceed to the next step.
-
Right-click the element in the Link Target
area you want to set as a loop element and select Set As
Loop Element from the contextual menu.In this example, Id is the iterating
object. -
Click OK to validate your changes and close
the dialog box.
Saving and executing the Job
- Press Ctrl+S to save your Job.
-
Execute the Job by pressing F6 or clicking
Run on the Run tab.The new data record is inserted in the Agency business
entity in the DStar data container on the MDM server. This
data records holds, as you defined in the schema, the agency id, the agency name
and the agency offices located in three cities.
Removing master data partially from the MDM hub
This scenario applies only to Talend MDM Platform and Talend Data Fabric.
The scenario describes how to partially remove the master data which has been written into
the MDM server in the scenario Writing master data in an MDM hub.
In this example, one agency office will be removed from the Agency business entity. The agency now has an id, a name and three offices
located in different cities.
For more information about entities, see
Talend Studio User Guide.
Dropping and linking the components
-
From the Palette, drop tFixedFlowInput and tMDMOutput
onto the design workspace. -
Connect the components using a Row Main
link.
Configuring the components
Specifying the data to be removed from the MDM server
-
Double-click tFixedFlowInput to view its
Basic settings in the Component tab. -
In the Schema list, select Built-In and then click the three-dot button next to
Edit schema to open a dialog box in which
you can define the structure of the master data to be used for partially
removing the master data on the MDM server. -
Click the [+] button and add three columns of
the type String.In this example, name the columns Id,
Name, and Remove_Office. - Click OK to save your changes.
-
In the Number of rows field, enter the number
of rows you want to generate. -
In the Mode area, select the Use
Single Table option. -
In the Value fields, enter values which
correspond to each of the schema columns.In this example, the office in Paris will
be removed.
Basic settings of tMDMOutput
-
In the design workspace, click tMDMOutput to
open its Basic settings view. -
In the Input Schema list, select Built-In and then click Sync
columns.After receiving data from the previous component, the tMDMOutput component basically generates an XML document, writes
it in an output field, and then sends it to the MDM server. -
Click OK to proceed to the next step.
The Result of the XML serialization list in
the Basic settings view is automatically filled
in with the output xml column. -
In the URL field, enter the URL to access the
MDM server. -
In the Username and Password fields, enter the authentication information required
to connect to the MDM server. -
In the Data Model field, enter between quotes the name of
the data model against which you want to validate the master data you want to
write. -
In the Data Container, enter between quotes the name of
the data container into which you want to write the master data. -
In the Partial Update area, select the
Use Partial Update check box.In the Source Name filed that pops up with
your selection, enter the name to be used in the modification report. -
In the Pivot field, enter the xpath to the
multi-occurrence sub-element where data need to be removed.In this example, enter “Agency/Offices/Office”. -
Select the Delete check box, and then enter
“.” in the Key field.
Advanced settings of tMDMOutput
-
In the Component view, click Advanced settings to set the advanced parameters for
the tMDMOutput component. -
Click the […] next to Configure
XML Tree to open the tMDMOutput
editor.Alternatively, double-click tMDMOutput to
open the editor. -
In the Link target area to the right, click
in the XML Tree field and then replace
rootTag with the name of the business
entity in which you want to remove data partially, Agency
in this example. -
In the Linker source area, select the two
schema columns Id and Name and drop them on the Agency node.The Selection dialog box is
displayed.Select the Create as sub-element of target
node option so that the two columns are linked to the two XML
sub-elements of the Agency node. -
Right-click the root node Agency and then
select Add Sub-element.In the dialog box that pops up, enter a name for the new sub-element,
Offices in this example.Repeat the same procedure to create a new sub-element Office for the Offices node
which corresponds to the multi-occurence element Offices of the business entity Agency. -
In the Linker source area, select the schema column whose
corresponding data entry you want to remove, Remove_Office in this example, and drop it on the new Office node.The Selection dialog box is
displayed.Select the Create as sub-element of target
node option so that the column is linked to the XML sub-element
of the Offices node. - Click Ok to proceed to the next step.
-
Right-click the element in the Link Target
area you want to set as a loop element and select Set As
Loop Element from the contextual menu.In this example, Id is the iterating
object. -
Click OK to validate your changes and close
the dialog box.
Saving and executing the Job
- Press Ctrl+S to save your Job.
-
Execute the Job by pressing F6 or clicking
Run on the Run tab.The agency office located in Paris with the agency Id
PA05 is removed from the
Agency business entity in the DStar
data container on the MDM server.
Writing staging data into MDM
This scenario applies only to Talend MDM Platform and Talend Data Fabric.
This scenario describes a two-component Job that writes a generated data record into the
staging area of a data container on the MDM server.
-
Make sure the MDM server is up and running.
-
Make sure a Customer data container, and a
Customer data model with a
Customer entity have been created. For more
information, see
Talend Studio User Guide. -
You have been assigned a role with the appropriate user authorization and access rights to
the data model Customer.
In this example, the Customer data model is designed with the elements
of Id, account_num, fname,
and lname as follows:
Creating a Job to write staging data into MDM
-
From the Palette, drop tFixedFlowInput and tMDMOutput onto
the design workspace. -
Link the components using a Row > Main
connection.
Preparing the data to be written into MDM
-
Double-click tFixedFlowInput to view its
Basic settings in the Component tab. - Click the … button next to Edit schema to open the schema editor.
-
Click the [+] button and add five columns of the
type String.In this example, name the columns id,
account, firstname,
lastname, and staging_source. -
Click OK to close this dialog box, and then click
Yes in the Propagate dialog box to propagate the schema changes to tMDMOutput. -
Keep the default value 1 in the Number of
rows field. - In the Mode area, select Use Single Table.
-
In the Value fields, enter between quotes the
values which correspond to each of the schema columns.Column
Value
id
CRM01
account
188
firstname
John
lastname
Doe
staging_source
CRM
Configuring basic settings of tMDMOutput to write staging data into MDM
-
In the design workspace, click tMDMOutput to open
its Basic settings view. - Enter the user name and password for accessing the MDM server.
-
In the Data Model field, enter between quotes the
name of the data model against which you want to validate the staging data you want
to write. In this example, enter Customer between
quotes. -
In the Data Container, enter
Customer between quotes. - Select Staging from the Type list.
- Leave other options as default.
Configuring advanced settings of tMDMOutput to write staging data into MDM
- In the Component view, click the Advanced settings tab.
-
Click the […] next to Configure XML Tree to open the tMDMOutput editor.
Alternatively, double-click tMDMOutput to open
the editor. -
In the Link target area to the right, click in
the XML Tree field and then replace rootTag with the name of the business entity into which
you want to insert the data record, Customer in this
example. -
Add a namespace to write data into the metadata element source in this
example.- Right-click the Customer node, and select Add Name Space from the contextual menu.
-
In the Namespace dialog dialog box, enter
metadata in the Prefix field and
http://www.talend.com/mdm/metadata in the Namespace Value field. - Click OK to close the dialog box.
-
In the Linker source area, select the five schema
columns and drop them on the Customer node
respectively.The Selection dialog box is displayed. -
Select the Create as sub-element of target node option,
and click OK. -
In the XML Tree column, change the element names to the
corresponding elements you have defined in the Customer entity
or metata elements.Unlike elements defined in entities, metadata elements are built-in elements. To write
metadata elements for records into staging database, you need to follow the
format ofmetadata:staging_<source|status|error|blockkey>
when
defining the path expression to select the XML node. -
Right-click the element in the Link Target area
you want to set as a loop element and select Set As Loop
Element from the contextual menu.In this example, Id is the iterating object. -
Click OK to validate your changes and close the
dialog box.
Executing the Job to write staging data into MDM and verifying the execution
result
- Press Ctrl+S to save your Job.
-
Execute the Job by pressing F6 or clicking
Run on the Run
tab.Log into your
Talend MDM Web UI
to check the newly added
staging record for the Customer data container.