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
| Parameter | Type | Description |
|---|---|---|
| input | Union[Table, Sequence[Table], MultiJoinInput, Sequence[MultiJoinInput]] | The tables to join, or |
| on optional | Union[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., This parameter must be omitted when |
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
| Parameter | Type | Description |
|---|---|---|
| table | Table | The table to join onto. |
| on optional | Union[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., |
| joins optional | Union[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., |
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.