partitioned_agg_by
partitioned_agg_by is a convenience method that performs an agg_by operation on the source table and wraps the result in a PartitionedTable.
Note
If the argument aggs does not include a partition aggregation created by calling agg.partition(), one will be added automatically with the default constituent column name __CONSTITUENT__.
Syntax
Parameters
| Parameter | Type | Description |
|---|---|---|
| aggs | Union[Aggregation, Sequence[Aggregagation]] | The aggregation(s) to apply to the source table. |
| by optional | Union[str, Sequence[str]] | The group by column name(s). The default is |
| preserve_empty optional | bool | Whether to keep result rows for groups that are initially empty, or become empty as a result of updates.
Each aggregation operator defines its own value for empty groups. The default is |
| initial_groups optional | Table | A table whose distinct combinations of values for the group by column(s) should be used to create an initial set of aggregation groups. All other columns are ignored.
When a table is provided, the Note: Changes to this table are not expected or handled; if this table is a refreshing table, only its contents at instantiation time will be used. |
Returns
A PartitionedTable.
Examples
In this example, partitioned_agg_by returns the source table, as partitioned by StreetName.
The partitioned table is identical to the source table, so the constituent_tables method is invoked to demonstrate that the table has been partitioned.