Home
Overview
Fundamentals
Glossary
Cheatsheet
API Reference
Quick Recipes
Deep Dive
Common Pitfalls and Gotchas
Persistent Storage
Action to get the keys of a Koda DICT data slice.
DictGetKeys.evaluate(self, data_slice: kd.types.DataSlice) -> kd.types.DataSliceEvaluates the action on the given data slice.
DictGetKeys.get_subschema(self, schema: kd.types.DataItem) -> kd.types.DataItemReturns the schema after applying the action on a DataSlice with `schema`.
Args:
schema: the schema of a hypothetical DataSlice.
Returns:
The schema after applying the action on an arbitrary DataSlice with schema
`schema`.
Raises:
IncompatibleSchemaError: if the action is not compatible with the given
schema.
DictGetKeys.get_subschema_bag(self, schema: kd.types.DataItem) -> kd.types.DataBagReturns the minimal schema bag needed for the subschema operation.
Args:
schema: the schema of a hypothetical DataSlice.
Returns:
The minimal schema bag needed for self.get_subschema_operation() to
succeed on `schema`.
DictGetKeys.get_subschema_operation(self) -> strReturns the operation to obtain the subschema in get_subschema.
This is decoupled from str(self), because conceptually the operation on the
schema has a coarser granularity. For example, "[:4]" is a conceptually
valid action on a data slice, but its corresponding schema operation is
the same as that of "[:]", namely ".get_item_schema()".
DictGetKeys.parse_from_data_slice_path_prefix(data_slice_path: str) -> tuple[DataSliceAction, str] | NoneParses the given path to return an action and the remaining path.
Args:
data_slice_path: the data slice path from which to parse a prefix.
Returns:
A tuple of the parsed action and the remaining part of the data slice
path. If the action does not apply, then None is returned. If the action
is applicable but cannot be parsed, then an ActionParsingError is raised.
Raises:
ActionParsingError: if the action is applicable but it cannot be parsed.