Concatenate Tables
Stack tables into one
how decides what concat() does when the inputs do not line up.
Needs a transformer. Getting its guide.
Called tabsdata 2 times (ctrl+o to expand)
Generating — concat() appends rows, and the default how="vertical" is right here because both inputs carry the same three columns with the same types.
Called tabsdata 3 times (ctrl+o to expand)
The transformer, registered in subscriptions:
@transformer(
input_tables=["sales_east", "sales_west"],
output_tables=["sales_all"],
)
def combine_sales(east: TableFrameSpec, west: TableFrameSpec) -> TableFrameSpec:
return concat([east, west])
Execution committed, 0 failures.
subscriptions/sales_all is live — 2 rows from sales_east then 2 from sales_west, in that order, columns unchanged:
┌────────┬───────┬────────┐ │ region │ month │ amount │ ├────────┼───────┼────────┤ │ east │ jan │ 10 │ ├────────┼───────┼────────┤ │ east │ feb │ 20 │ ├────────┼───────┼────────┤ │ west │ jan │ 30 │ ├────────┼───────┼────────┤ │ west │ feb │ 40 │ └────────┴───────┴────────┘
Transformed tables
| region | month | amount |
|---|---|---|
| east | jan | 10 |
| east | feb | 20 |
| region | month | amount |
|---|---|---|
| west | jan | 30 |
| west | feb | 40 |
| region | month | amount |
|---|---|---|
| east | jan | 10 |
| east | feb | 20 |
| west | jan | 30 |
| west | feb | 40 |
None entries in the list are skipped. A list that is None, empty, or empty
once the None entries are dropped makes concat() return None, which leaves
the output table on its current version instead of committing a new one.