atoti.Table.join()#
- Table.join(other, mapping=None, /)#
Define a join between this table and another.
There are two kinds of joins:
full join if all the key columns of the other table are mapped and the joined tables share the same locality (either both
Table
or bothExternalTable
).partial join otherwise.
Depending on the cube creation mode, the join will also generate different hierarchies and measures:
manual
: No hierarchy is automatically created. For partial joins, creating a hierarchy for each mapped key column is necessary before creating hierarchies for the other columns. Once these required hierarchies exist, hierarchies for the un-mapped key columns of the other table will automatically be created.no_measures
: All the key columns and non-numeric columns of the other table will be converted into hierarchies. No measures will be created in this mode.auto
: The same hierarchies as in theno_measures
mode will be created. Additionally, columns of the base table containing numeric values (including arrays), except for columns which are keys, will be converted into measures. Columns of the other table with these types will not be converted into measures.
- Parameters:
other (Table) – The other table to join.
mapping (Condition[ColumnIdentifier, Literal['eq'], ColumnIdentifier, ~typing.Literal['and'] | None] | None) – An equality-based condition from columns of this table to columns of the other table. If
None
, the key columns of the other table with the same name as columns in this table will be used.
Example
>>> sales_table = session.create_table( ... "Sales", ... types={"ID": tt.STRING, "Product ID": tt.STRING, "Price": tt.INT}, ... ) >>> products_table = session.create_table( ... "Products", ... types={"ID": tt.STRING, "Name": tt.STRING, "Category": tt.STRING}, ... ) >>> sales_table.join( ... products_table, sales_table["Product ID"] == products_table["ID"] ... )