Catch type errors
Fixes error on GAE when using Djangae's defer_iteration_with_finalize
:
Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/djangae/tasks/deferred.py", line 372, in _process_shard
for instance in qs.all():
File "/srv/goals/queryset.py", line 50, in __iter__
return super().__iter__()
File "/env/lib/python3.7/site-packages/django/db/models/query.py", line 274, in __iter__
self._fetch_all()
File "/srv/goals/queryset.py", line 62, in _fetch_all
return super()._fetch_all()
File "/env/lib/python3.7/site-packages/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/env/lib/python3.7/site-packages/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/env/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1129, in execute_sql
sql, params = self.as_sql()
File "/env/lib/python3.7/site-packages/gcloudc/db/backends/datastore/compiler.py", line 39, in as_sql
select = SelectCommand(self.connection, self.query)
File "/env/lib/python3.7/site-packages/gcloudc/db/backends/datastore/commands.py", line 315, in __init__
self.query = normalize_query(self.query)
File "/env/lib/python3.7/site-packages/gcloudc/db/backends/datastore/dnf.py", line 308, in normalize_query
remove_unnecessary_nodes(query.where)
File "/env/lib/python3.7/site-packages/gcloudc/db/backends/datastore/dnf.py", line 289, in remove_unnecessary_nodes
seen[key].value = max(seen[key].value, node.value)
TypeError: '>' not supported between instances of 'Key' and 'Key'
Edited by Andrei Petre