zcollection.collection.Collection.partitions#

Collection.partitions(*, cache=None, lock=False, filters=None, relative=False)#

List the partitions of the collection.

Parameters:
  • cache (Iterable[str] | None) – The list of partitions to use. If None, the partitions are listed.

  • lock (bool) – Whether to lock the collection or not to avoid listing partitions while the collection is being modified.

  • filters (str | Callable[[Dict[str, int]], bool] | None) – The predicate used to filter the partitions to load. If the predicate is a string, it is a valid python expression to filter the partitions, using the partitioning scheme as variables. If the predicate is a function, it is a function that takes the partition scheme as input and returns a boolean.

  • relative (bool) – Whether to return the relative path.

Returns:

The list of partitions.

Return type:

Iterator[str]

Example

>>> tuple(collection.partitions(
...     filters="year == 2019 and month == 1"))
('year=2019/month=01/day=01', 'year=2019/month=01/day=02/', ...)
>>> tuple(collection.partitions(
...     filters=lambda x: x["year"] == 2019 and x["month"] == 1))
('year=2019/month=01/day=01', 'year=2019/month=01/day=02/', ...)