Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Google App Engine fetch()值错误:需要超过1个值才能解包_Python_Google App Engine - Fatal编程技术网

Python Google App Engine fetch()值错误:需要超过1个值才能解包

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部分,因

执行上述代码会导致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部分,因为在开始时,光标为空。批量大小>=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)