Google app engine 使用远程APi从应用程序引擎导出数据时出现属性错误
使用appengine中的示例代码将给出一个属性错误。更奇怪的是, 当批次大小为100时,第一次提取将给出错误,而如果设置为10,第二次提取将给出错误,当批次大小为1时,第25次提取将给出错误。是因为远程API的问题吗 Python版本:2.7 App engine sdk版本:1.9.6Google app engine 使用远程APi从应用程序引擎导出数据时出现属性错误,google-app-engine,google-cloud-datastore,Google App Engine,Google Cloud Datastore,使用appengine中的示例代码将给出一个属性错误。更奇怪的是, 当批次大小为100时,第一次提取将给出错误,而如果设置为10,第二次提取将给出错误,当批次大小为1时,第25次提取将给出错误。是因为远程API的问题吗 Python版本:2.7 App engine sdk版本:1.9.6 query = MyModel.all() entities = query.fetch(100) while entities: for entity in entities: #
query = MyModel.all()
entities = query.fetch(100)
while entities:
for entity in entities:
# Do something with entity
query.with_cursor(query.cursor())
entities = query.fetch(100)
错误消息:
Traceback (most recent call last):
File "migrate.py", line 77, in <module>
entities = query.fetch(batch_size)
File "/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", line 2157, in fetch
return list(self.run(limit=limit, offset=offset, **kwargs))
File "/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", line 2326, in next
return self.__model_class.from_entity(self.__iterator.next())
File "/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", line 1435, in from_entity
entity_values = cls._load_entity_values(entity)
File "/home/kamel/Library/google_appengine/google/appengine/ext/db/__init__.py", line 1413, in _load_entity_values
value = prop.make_value_from_datastore(value)
File "/home/kamel/labola/src/model/properties.py", line 295, in make_value_from_datastore
return pickle.loads(value)
File "/usr/lib/python2.7/pickle.py", line 1382, in loads
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1083, in load_newobj
obj = cls.__new__(cls, *args)
AttributeError: class Reference has no attribute '__new__
我在尝试在python2下解开python3泡菜时遇到了同样的问题。这个问题与python3中的新型类成为默认类有关
我的解决方案是用类AClass替换类AClass:对象似乎是损坏的数据。从第20条记录开始提取时会发生什么?但我只使用Python2.7。因为有些是可以腌制的,有些是不能腌制的,我不认为原因是这样的。