PreconditionFailed: 412 no matching index found. when using inequality filters
See original GitHub issueI am using appengine to run my app and gcloud for accessing cloud datastore. I have gcloud model where i am storing username and date_time attribute.
but when i am doing this.
from gcloud.datastore.query import Query
from datetime import datetime
query = Query(kind="MyTable")
query.add_filter('username', '=', 'somevalue')
query.add_filter('date_time', '<', datetime.now())
iterator = query.fetch(limit=10)
records, more, cursor = iterator.next_page()
print records
I am getting the following exception.
File "/Users/sathyanarrayanan/Desktop/app/services/cdr_helper.py", line 528, in fetch_last_users
records, more, cursor = iterator.next_page()
File "/Users/sathyanarrayanan/Desktop/app/gcloud/datastore/query.py", line 388, in next_page
transaction_id=transaction and transaction.id,
File "/Users/sathyanarrayanan/Desktop/app/gcloud/datastore/connection.py", line 257, in run_query
datastore_pb.RunQueryResponse)
File "/Users/sathyanarrayanan/Desktop/app/gcloud/datastore/connection.py", line 108, in _rpc
data=request_pb.SerializeToString())
File "/Users/sathyanarrayanan/Desktop/app/gcloud/datastore/connection.py", line 85, in _request
raise make_exception(headers, content, use_json=False)
PreconditionFailed: 412 no matching index found.
Below is my index file.
#File index.yaml
- kind: MyTable
ancestor: yes
properties:
- name: date_time
- kind: MyTable
ancestor: yes
properties:
- name: date_time
direction: desc
- kind: MyTable
ancestor: yes
properties:
- name: username
direction: asc
- name: date_time
direction: desc
- kind: MyTable
ancestor: yes
properties:
- name: username
direction: asc
- name: date_time
for more details: http://stackoverflow.com/questions/32607351/412-no-matching-index-found-while-executing-a-query-in-cloud-datastore
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Google Cloud Datastore runQuery returning 412 "no matching ...
According to the docs, "a query can combine equality (EQUAL) filters for different properties, along with one or more inequality filters on a ......
Read more >gcloud.exceptions.BadRequest: 400 - No matching index error ...
I am running a service in GCE which accesses cloud data store. I created an index for one of the Kinds in data...
Read more >No Matching Index Found. Using Objectify - ADocLib
PreconditionFailed : 412 no matching index found. when using inequality filters ... Datastore: Filtering with equality fails with FailedPrecondition desc no ...
Read more >Integrating Data With External Applications - IBM
Event Filter Class. Any Java classes you specify must be part of the application EAR file. An XSL file can be within the...
Read more >Change History | AllegroGraph 6.4.4 - Franz Inc.
Using the Japanese text index tokenizer on a system that does not have ... Bug24665 - SPARQL queries with :dateTime inequality filters could...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@plasmashadow I executed the following snippet in the dev server:
The dev server automatically generated the following:
If you are actually storing keys with ancestors, you’ll need to use the
Query.ancestorsetter.Great to hear!