This gem runs in .
Overview
Use the Join gem to combine related data from two or more datasets. Common use cases include:- adding customer details to order records
- combining user activity with account information
- enriching datasets with lookup tables
- matching records between systems
How to choose a join type
Choose:- Inner Join to keep only matching rows.
- Left Join to keep all rows from the first dataset.
- Right Join to keep all rows from the second dataset.
- Full Outer Join to keep all rows from both datasets.
- Cross Join to combine every row from both datasets.
Common join examples
Input and Output
To add additional input ports, click
+ next to Ports.
Parameters
To configure the Join gem, you need to define join conditions and select the columns that will appear in the output table.Join conditions
You can add one or more join conditions to the gem depending on the number of input tables added. Rows are matched using shared values, such as customer IDs, order IDs, or email addresses.If you want to use a type of join that is available in your SQL warehouse, you can type the name
of that join directly in Prophecy.
Expressions
Example
Assume you have two tables: orders and customers. You want the orders table to include customer information, so you need to join the tables based on customer ID. You only want to preserve records in the output that have a match. To do so:- Connect orders to in0 and customers to in1.
- Choose Inner Join as the join type.
- If using a visual expression, use the following join condition: in0.CustomerID equals in1.customer_id
- If using the code expression, use the following SQL join condition: in0.CustomerID = in1.customer_id
- Leave the Expressions tile empty.
- Save and run the gem.
Common issues
Duplicate rows after joining
Duplicate rows can occur when multiple rows in one table match the same row in another table. Verify that:- the join keys are unique when expected
- the correct join type is selected
- duplicate records do not exist in the input datasets
Missing records in the output
Rows may be excluded depending on the selected join type. For example:- Inner Join keeps only matching rows
- Left Join keeps all rows from the left table
- Full Outer Join keeps all rows from both tables
Null values in joined columns
Rows withNULL join keys may not match other rows.
Ambiguous column names
If both datasets contain columns with the same name, rename or qualify columns to avoid ambiguity.Join types
Suppose there are two tables, Employees and Departments, with the following contents:Employees
Departments
INNER JOIN
Inner Join will return columns from both the tables and only the matching records as long as the condition is satisfied. For example, if the Join condition provided wasemployees.department_id = departments.department_id, the sample query would be:
LEFT JOIN / LEFT OUTER JOIN
Left Join (or Left Outer join) will return columns from both the tables and match records with records from the left table. The result-set will contain null for the rows for which there is no matching row on the right side. For example, if the Join condition provided wasemployees.department_id = departments.department_id, the sample query would be:
RIGHT JOIN / RIGHT OUTER JOIN
Right Join (or Right Outer Join) returns matching rows from both tables and preserves all rows from the right table. Rows from the right table that do not have a match in the left table will containNULL values for the left table columns.
For example, if the join condition is employees.department_id = departments.department_id, the sample query would be:

