User Tools

Site Tools


transformations:merge

This is an old revision of the document!


MERGE ANOTHER TABLE

Category: Transform / Basic


Description

This action appends one or more columns from another table where the values in certain columns in both tables match.

There are three possible merge modes:

Lookup Mode

Retrieve the first matching combination from the other table. Any subsequent combinations are ignored.

Left Join Mode

Retrieve all matching combinations from the other table. This mode can increase the number of rows in the current table as rows are duplicated to hold any multiple matches from the second dataset.

Full Join Mode

Include all combinations of keys from both tables. Equivalent to the full outer join in SQL. This mode could potentially return very large datasets.


Limitations

The resulting table after Merge can't have more than 134,217,728 rows.


Use cases

  • (Lookup Mode) Look up replacement values for common misspellings or abbreviations.
  • (Left Join Mode) Blend in additional data from other tables into the primary dataset.
  • (Full Join Mode) Combine two entire datasets to be cleaned and consolidated downstream.


Action settings

SettingDescription
Add columns from tableSelect table that will return columns to the current dataset where values match.
Where all these columns matchSelect the columns within the current dataset (left drop-down) and the second dataset (right drop-down) where
values will match. To define multi-columnar matches, use the Add more matching columns to select additional matching columns in each dataset.
Merge modeOptions:
Lookup (for each row in this table, get any one matching row from the second table and ignore other matches),
Left join (for each row in this table add all matching rows from the second table),
Full join (add matching and non-matching rows from both tables).
Return columnsFrom the list, select the columns from the second dataset that will be appended to the current dataset.

The reference to the second table will appear as a dotted line connecting this action to the second dataset in the application window.


Examples

Objective: Merge the "Outflow" column of Table 2 into Table 1 based on matching values in the "Rivers" columns in both tables.

Table 1: The longest rivers in the world

River Length (km) Continent
Nile 6650Africa
Amazon 6400South America
Yangtze 6300Asia
Mississippi 6275North America


Table 2: The outflow

River Outflow
Nile Mediterranean
Amazon Atlantic Ocean
Yangtze East China Sea
Mississippi Gulf of Mexico


Action parameters:

Add columns from table: Table 2
Where values in the Table 1 "River" column match values in the Table 2 "River" column
Merge mode: Left join (add all matching rows from Table 2 to Table 1)
Return column: Outflow


Result:

River Length (km) Continent Outflow
Nile 6650Africa Mediterranean
Amazon 6400South America Atlantic Ocean
Yangtze 6300Asia East China Sea
Mississippi 6275North America Gulf of Mexico


See also

transformations/merge.1617597211.txt.gz · Last modified: 2021/04/05 00:33 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki