Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

Python 3.10 is now available in preview.

google.appengine.api.datastore_types.RestoreFromIndexValue

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.