-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.
Description
Hey,
we have a list in our datastore with ids and sometimes nulls in it. Like here:
["null","null","a953c730fc2e4647b3a5b4e88fa4f0ce","59ce754ddf03401eb09abd50c977cf67","null"]
When we try to fetch them, we get the "Different meanings set on values within a list_value" Exception.
Is this a bug, that the method does not handles null?
def _get_meaning(value_pb, is_list=False):
meaning = None
if is_list:
# An empty list will have no values, hence no shared meaning
# set among them.
if len(value_pb.list_value) == 0:
return None
# We check among all the meanings, some of which may be None,
# the rest which may be enum/int values.
all_meanings = set(_get_meaning(sub_value_pb)
for sub_value_pb in value_pb.list_value)
meaning = all_meanings.pop()
# The value we popped off should have been unique. If not
# then we can't handle a list with values that have more
# than one meaning.
if all_meanings:
raise ValueError('Different meanings set on values '
'within a list_value')
elif value_pb.meaning: # Simple field (int32)
meaning = value_pb.meaning
return meaningMetadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.