According to https://cloud.google.com/python/docs/reference/datastore/latest/queries#class-googleclouddatastorequerypropertyfilterpropertyname-operator-value I should be able to run the following query
q = client.query(kind='transcription')
result = list(q.add_filter(filter=query.PropertyFilter("status", "=", "IN_PROCESS")).fetch())
print(result)
However, when I run I got
google.api_core.exceptions.FailedPrecondition: 400 The query requires an ASC or DESC index for kind transcription and property status. Please use the gcloud CLI to remove the single-property index exemption for this property.
When I checked the documentation, I found that I should create an index first, using 1 field filter to perform a query my index looks like this
indexes:
- kind: transcription
properties:
- name: status
When I run gcloud datastore indexes create index.yaml I got
ERROR: (gcloud.datastore.indexes.create) INVALID_ARGUMENT: This index:
Datastore index on 'transcription' for (status ASC)
is not necessary, since single-property indexes are built in. Please remove it from your index file and upgrade to the latest version of the SDK, if you haven't already.
It looks like for queries using 1 field filter, no index is required. But why I still got the error.
Your database is in the wrong mode. You can see the mode with the gcloud command (https://cloud.google.com/sdk/gcloud/reference/firestore/databases/describe). To use the Datastore APIs, you need to be in Firestore in Datastore mode.