3
gql_query.query_string = "SELECT * FROM <entity> where `timestamp` <= datetime('2014-06-05 00:00:00')"
gql_query.allow_literal = True
resp = datastore.run_query(req)
results = [entity_result.entity
for entity_result in resp.batch.entity_result]
上的时间戳字段查询时当运行上述查询它如下产生错误错误:googledatastore包:与日期时间函数
ERROR:root:Error while doing datastore operation
ERROR:root:RPCError: runQuery Invalid datetime text (does not match pattern): "2014-06-05 00:00:00"
ERROR:root:HTTPError: 400 Bad Request
谢谢。这工作!我使用的是与App Engine API相同的查询。它在那里工作。 –
是的,Python/App Engine GQL与Cloud Datastore GQL略有不同。您可以在这里查看差异摘要:https://developers.google.com/datastore/docs/apis/gql/gql_reference#unsupported_features_and_behavior_differences_from_mysqlpython_gql –