Reprint: http://blog.itpub.net/post/37422/464323
This step is used to merge data from two different sources, both old data and new data, which match, compare, and merge the old and new data according to the specified keywords.
Parameters that need to be set:
Old data source: Steps for old data sources
New data sources. Steps for new data sources
Flag field: Sets the name of the Flag field, which is used to save the results of the comparison, with the following several results.
1. "Identical" – Same old data as new data
2. "Changed" – the data has changed;
3. "New" – records that have not been found in the old data
4. "Deleted" – records in old data that are not in the new data
Key field: Used to locate the same record in two data sources.
Compare fields: For the same record in two data sources, specify the fields that you want to compare.
The combined data will include all the data from the old data source and the new data source, replace the old data with the new data for the changed data, and use an indicator field in the results to specify the comparison results for the old and new data.
Attention:
Old data and new data need to be sorted in advance by key fields.
The old data and the new data have the same field name.
Example:
Old data:
Field1, Field2
1, 1
2, 2
3, 3
4, 4
New data
Field1, Field2
1, 1
2, 9
5, 5
Settings: Flag field is flag, key field is field1, comparison field is Field2
The merged data
Field1; Field2; Flag
1; 1; Identical
2; 9; Changed
3; 3; Deleted
4; 4; Deleted
5; 5; New
Kettle Merge Record steps