multi_join

The multi_join method creates a MultiJoinTable object by performing a multi-table natural join on the source tables. The result consists of a set of distinct keys natural-joined to each source table. Source tables are not required to have a matching row for each key but may not have multiple matching rows for a given key.

Syntax

Parameters

ParameterTypeDescription
inputUnion[Table, Sequence[Table], MultiJoinInput, Sequence[MultiJoinInput]]

The tables to join, or MultiJoinInput objects specifiying tables and columns to join.

on optionalUnion[str, Sequence[str]]

The column(s) to match. This can be a common name or an equality expression that renames columns to match, e.g., "col_A = col_B".

This parameter must be omitted when MultiJoinInput objects are provided.

Returns

A MultiJoinTable object.

Objects

MultiJoinTable

A MultiJoinTable object contains the result of a multi_join operation. The resulting table can be retrieved with the table attribute.

MultiJoinInput

A MultiJoinInput is an object that represents the input tables, key columns, and additional columns to be used in a multi_join operation.

MultiJoinInput Parameters

ParameterTypeDescription
tableTable

The table to join onto.

on optionalUnion[str, Sequence[str]]

The column(s) to match. This can be a name common to both columns or an equality expression that renames columns to match, e.g., "col_A = col_B".

joins optionalUnion[str, Sequence[str]]

The column(s) to be added from this table to the result table. This can be a common name or an equality expression that renames columns to match, e.g., "col_A = col_B".

Examples

This example shows how to use multi_join by using tables and column names as inputs.

The following example uses the source tables from the previous example, but joins them using MultiJoinInput objects instead of tables and column names. This is slightly more complex than using tables and column names, but gives the user a higher degree of control over multi_join's behavior.