Python Google App Engine fetch()值错误:需要超过1个值才能解包
执行上述代码会导致ValueError:需要超过1个值才能解包 当我将BATCH_SIZE值设置为3而不是1时,错误得到解决。但是,它仍然只获取第一行数据,而不是全部3行数据 整个功能供参考:Python Google App Engine fetch()值错误:需要超过1个值才能解包,python,google-app-engine,Python,Google App Engine,执行上述代码会导致ValueError:需要超过1个值才能解包 当我将BATCH_SIZE值设置为3而不是1时,错误得到解决。但是,它仍然只获取第一行数据,而不是全部3行数据 整个功能供参考: gql_query = "SELECT * FROM Dev_DB" searchquery = ndb.gql(gql_query) BATCH_SIZE = 1 results, cursor, more = searchquery.fetch(BATCH_SIZE) 问题发生在else部分,因
gql_query = "SELECT * FROM Dev_DB"
searchquery = ndb.gql(gql_query)
BATCH_SIZE = 1
results, cursor, more = searchquery.fetch(BATCH_SIZE)
问题发生在else部分,因为在开始时,光标为空。批量大小>=3的任何值均有效。代码从未转到if部分,因为初始获取未成功,因此光标未作为参数设置到URL
我是谷歌应用程序引擎的新手。非常感谢您的帮助。我使用的是fetch而不是fetch\u页面。fetch用于DB,fetch_页面用于NDB
def update_pose_order_db_controller(self):
self.response.headers['Content-type']="text/html"
self.response.out.write("<p>Hello there, Fetching from dev</p>")
cursor_from_url = self.request.get('start_cursor')
logging.info("Cursor in start is: {}".format(cursor_from_url))
gql_query = "SELECT * FROM Dev_DB"
searchquery = ndb.gql(gql_query)
if cursor_from_url:
cursor_from_url = Cursor(urlsafe=cursor_from_url)
BATCH_SIZE = 2
results, cursor, more = searchquery.fetch(BATCH_SIZE, start_cursor = cursor_from_url)
else:
BATCH_SIZE = 1
results, cursor, more = searchquery.fetch(BATCH_SIZE)
self.response.write(results.ans_list)