Query App和Google App Engine中的Gqlquery类之间有什么区别?

时间:2023-01-24 00:11:35

Are they just different interfaces to the same underlying query?

它们只是同一底层查询的不同接口吗?

1 个解决方案

#1


[snippet from http://code.google.com/appengine/docs/python/datastore/gqlqueryclass.html] As with the Query class, the application executes the query and accesses results either by calling the fetch() method, or by treating the GqlQuery object as an iterable. See the Query documentation for more information.

[来自http://code.google.com/appengine/docs/python/datastore/gqlqueryclass.html的代码段]与Query类一样,应用程序通过调用fetch()方法执行查询并访问结果,或者将GqlQuery对象视为可迭代的。有关更多信息,请参阅查询文档。

There is one difference between how Query and GqlQuery access results: If the GQL query includes a LIMIT clause or an OFFSET clause, results are retrieved as with the equivalent fetch() method, even if the iterator interface is used to access the results. When a GqlQuery whose GQL contains LIMIT or OFFSET is used as an iterable, one call is made to the datastore to fetch all of the results, and the iterator returns each of the results from memory.

Query和GqlQuery访问结果之间存在一个区别:如果GQL查询包含LIMIT子句或OFFSET子句,则使用等效的fetch()方法检索结果,即使使用迭代器接口访问结果也是如此。当其GQL包含LIMIT或OFFSET的GqlQuery用作可迭代时,将对数据存储区进行一次调用以获取所有结果,并且迭代器返回内存中的每个结果。

#1


[snippet from http://code.google.com/appengine/docs/python/datastore/gqlqueryclass.html] As with the Query class, the application executes the query and accesses results either by calling the fetch() method, or by treating the GqlQuery object as an iterable. See the Query documentation for more information.

[来自http://code.google.com/appengine/docs/python/datastore/gqlqueryclass.html的代码段]与Query类一样,应用程序通过调用fetch()方法执行查询并访问结果,或者将GqlQuery对象视为可迭代的。有关更多信息,请参阅查询文档。

There is one difference between how Query and GqlQuery access results: If the GQL query includes a LIMIT clause or an OFFSET clause, results are retrieved as with the equivalent fetch() method, even if the iterator interface is used to access the results. When a GqlQuery whose GQL contains LIMIT or OFFSET is used as an iterable, one call is made to the datastore to fetch all of the results, and the iterator returns each of the results from memory.

Query和GqlQuery访问结果之间存在一个区别:如果GQL查询包含LIMIT子句或OFFSET子句,则使用等效的fetch()方法检索结果,即使使用迭代器接口访问结果也是如此。当其GQL包含LIMIT或OFFSET的GqlQuery用作可迭代时,将对数据存储区进行一次调用以获取所有结果,并且迭代器返回内存中的每个结果。