pyarrow.dataset.get_partition_keys

pyarrow.dataset.get_partition_keys(Expression partition_expression)

Extract partition keys (equality constraints between a field and a scalar) from an expression as a dict mapping the field’s name to its value.

NB: All expressions yielded by a HivePartitioning or DirectoryPartitioning will be conjunctions of equality conditions and are accessible through this function. Other subexpressions will be ignored.

Parameters:
partition_expressionpyarrow.dataset.Expression
Returns:
dict

Examples

For example, an expression of <pyarrow.dataset.Expression ((part == A:string) and (year == 2016:int32))> is converted to {‘part’: ‘A’, ‘year’: 2016}