Python 3.9 is now generally available.


Restores an index value to the correct datastore type.

Projection queries return property values directly from a datastore index. These values are the native datastore values that can be one of the following: str, bool, long, float, GeoPt, Key, or User. This function restores the original value when the original type is known.

This function returns the value type returned when decoding a normal entity, not necessarily of type data_type. For example, data_type=int returns a long instance.

index_value The value returned by FromPropertyPb for the projected property.
data_type The type of the value originally given to ToPropertyPb.

The restored property value.

datastore_errors.BadValueError if the value cannot be restored.