Joins
tablite.joins
Classes
Functions
tablite.joins.join(T: BaseTable, other: BaseTable, left_keys: List[str], right_keys: List[str], left_columns: Union[List[str], None], right_columns: Union[List[str], None], kind: str = 'inner', merge_keys: bool = False, tqdm=_tqdm, pbar=None)
short-cut for all join functions.
PARAMETER | DESCRIPTION |
---|---|
T |
left table
TYPE:
|
other |
right table
TYPE:
|
left_keys |
list of keys for the join from left table.
TYPE:
|
right_keys |
list of keys for the join from right table.
TYPE:
|
left_columns |
list of columns names to retain from left table. If None, all are retained.
TYPE:
|
right_columns |
list of columns names to retain from right table. If None, all are retained.
TYPE:
|
kind |
'inner', 'left', 'outer', 'cross'. Defaults to "inner".
TYPE:
|
tqdm |
tqdm progress counter. Defaults to _tqdm.
TYPE:
|
pbar |
tqdm.progressbar. Defaults to None.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
if join type is unknown. |
RETURNS | DESCRIPTION |
---|---|
Table
|
joined table. |
Example: "inner"
SQL: SELECT number, letter FROM numbers JOIN letters ON numbers.colour == letters.color
Tablite:
>>> inner_join = numbers.inner_join(
letters,
left_keys=['colour'],
right_keys=['color'],
left_columns=['number'],
right_columns=['letter']
)
Example: "left"
SQL: SELECT number, letter FROM numbers LEFT JOIN letters ON numbers.colour == letters.color
Tablite:
>>> left_join = numbers.left_join(
letters,
left_keys=['colour'],
right_keys=['color'],
left_columns=['number'],
right_columns=['letter']
)
Example: "outer"
SQL: SELECT number, letter FROM numbers OUTER JOIN letters ON numbers.colour == letters.color
Tablite:
>>> outer_join = numbers.outer_join(
letters,
left_keys=['colour'],
right_keys=['color'],
left_columns=['number'],
right_columns=['letter']
)
Example: "cross"
CROSS JOIN returns the Cartesian product of rows from tables in the join. In other words, it will produce rows which combine each row from the first table with each row from the second table
Source code in tablite/joins.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
tablite.joins.inner_join(T: BaseTable, other: BaseTable, left_keys: List[str], right_keys: List[str], left_columns: Union[List[str], None], right_columns: Union[List[str], None], merge_keys: bool = False, tqdm=_tqdm, pbar=None)
Source code in tablite/joins.py
113 114 115 116 |
|
tablite.joins.left_join(T: BaseTable, other: BaseTable, left_keys: List[str], right_keys: List[str], left_columns: Union[List[str], None], right_columns: Union[List[str], None], merge_keys: bool = False, tqdm=_tqdm, pbar=None)
Source code in tablite/joins.py
118 119 120 121 |
|
tablite.joins.outer_join(T: BaseTable, other: BaseTable, left_keys: List[str], right_keys: List[str], left_columns: Union[List[str], None], right_columns: Union[List[str], None], merge_keys: bool = False, tqdm=_tqdm, pbar=None)
Source code in tablite/joins.py
123 124 125 126 |
|
tablite.joins.cross_join(T: BaseTable, other: BaseTable, left_keys: List[str], right_keys: List[str], left_columns: Union[List[str], None], right_columns: Union[List[str], None], merge_keys: bool = False, tqdm=_tqdm, pbar=None)
Source code in tablite/joins.py
128 129 130 131 |
|