Google app engine 将Google应用程序引擎GqlQuery结果转换为Python字典

Google app engine 将Google应用程序引擎GqlQuery结果转换为Python字典,google-app-engine,Google App Engine,如何将应用程序引擎GqlQuery转换为字典,以便在转换为JSON字符串之前对其进行修改 问候, 约翰尼 p、 我知道也有类似的帖子,但建议的链接不再打开。您可以使用google.appengine.api.datastore中的低级数据存储界面(也有文档记录)。这为数据存储提供了一个接口,允许您使用字典而不是模型。您可以使用google.appengine.api.datastore中的低级数据存储接口(也有文档记录)。这为数据存储提供了一个接口,允许您使用字典而不是模型 entities =

如何将应用程序引擎GqlQuery转换为字典,以便在转换为JSON字符串之前对其进行修改

问候,

约翰尼


p、 我知道也有类似的帖子,但建议的链接不再打开。

您可以使用google.appengine.api.datastore中的低级数据存储界面(也有文档记录)。这为数据存储提供了一个接口,允许您使用字典而不是模型。

您可以使用google.appengine.api.datastore中的低级数据存储接口(也有文档记录)。这为数据存储提供了一个接口,允许您使用字典而不是模型

entities = YourKind.all().fetch(20)

dict_of_entities = dict((str(entity.key()), {'name': entity.name, 'size': entity.size}) for entity in entities)

# or

list_of_entities = [{'key': str(entity.key()),
                     'name': entity.name,
                     'size': entity.size} for entity in entities)]