Skip to main content
This gem runs in .

Overview

Use the UnionByName gem to combine rows from multiple datasets by matching column names. This can help when working with data from different sources where schemas might vary slightly in order or structure, but the column names are consistent.
The gem has a corresponding interactive gem example. See Interactive gem examples to learn how to run sample pipelines for this and other gems.

Prerequisites

  • Add prophecy_basics package version 1.0.0 or higher to your project.

Input and Output

To add additional input ports, click + next to Ports.

Parameters

Example

Let’s say you’re working with two tables: Table A and Table B.
  • Both tables contain order-related data.
  • Table B is missing the amount column that exists in Table A.
  • The columns in Table B that match Table A are ordered differently.

Table A

Table B

Result

The table below shows the output after running a UnionByName gem with Allow Missing Columns enabled. Since Table B doesn’t have the amount column, Prophecy fills in null values for rows coming from Table B.
This example will fail if you select No Missing Columns in the gem settings, since Table B is missing a column in Table A.