Python 2.7 RequestTooLargeError:对API调用数据存储\u v3.Put()的请求太大
我得到一个错误:Python 2.7 RequestTooLargeError:对API调用数据存储\u v3.Put()的请求太大,python-2.7,google-app-engine,memory-leaks,Python 2.7,Google App Engine,Memory Leaks,我得到一个错误: The request to API call datastore_v3.Put() was too large. File "/base/data/home/apps/s~app-prod/version/controllers/app/file.py", line 470, in function_name temp_o.put() RequestTooLargeError: The request to API call datastore_v3.Put() was to
The request to API call datastore_v3.Put() was too large.
File "/base/data/home/apps/s~app-prod/version/controllers/app/file.py", line 470, in function_name
temp_o.put()
RequestTooLargeError: The request to API call datastore_v3.Put() was too large.
对于以下代码:
temp_o = models.Temp.all().get()
temp_o.list = json.dumps(temp_list)
temp_o.put()
logging.info('size of list = %s', sys.getsizeof(temp_o.list))
当我使用以下代码获得临时列表的大小时:
temp_o = models.Temp.all().get()
temp_o.list = json.dumps(temp_list)
temp_o.put()
logging.info('size of list = %s', sys.getsizeof(temp_o.list))
我得到的结果是:
size of list = 4241156
由于sys.getsizeof()以字节为单位返回值,因此该值仅为4.2MB。为什么只保存4.2MB数据会导致Google App Engine中出现RequestTooLargeError错误?这是由于最大实体大小限制为1MB。在我的例子中,temp_o.list是一个TextProperty。请参阅(滚动到页面底部)这是由于最大实体大小有1MB限制。在我的例子中,temp_o.list是一个TextProperty。请参阅(滚动到页面底部)这是由于最大实体大小有1MB限制。在我的例子中,temp_o.list是一个TextProperty。请参阅(滚动到页面底部)这是由于最大实体大小有1MB限制。在我的例子中,temp_o.list是一个TextProperty。请参阅(滚动到页面底部)因为每个实体的限制是1mb,所以是的,4.2mb太大了因为每个实体的限制是1mb,所以是的,4.2mb太大了因为每个实体的限制是1mb,所以是的,4.2mb太大了,因为每个实体的限制是1mb,所以是的,4.2mb太大了