Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I ran into a problem with the Google Apps local dev server where my DataStore became corrupted. This happened around the time that I was modifying some of my code to be more efficient by offloading some processing to the DataStore via GQL. Unfortunately I didn't fully read the limitations of the DataStore GQL and wrote a statement that was not supported, which caused a DataStore corruption.

This is the kind of error I was getting from the dev server:
 Dev server error
EventError: could not determine a constructor for the tag '!'
in "<string>", line 38, column 11:
- name: !
^


I tracked this down to a GQL statement like this:
 GQL
SELECT * FROM MyEntity WHERE open != true ORDER BY date ASC


The problem was with the != operator. It's not supported!



From the GQL reference...
Python GQL supports operators != and OR. Those operators are not yet supported by Datastore GQL.


Doh! Oh well. That explained some of the problem, but what went wrong, but how to fix it? Well the reason why the DataStore became corrupted was this (source)...
The development web server (dev_appserver.py) automatically adds items to this file when the application tries to execute a query that needs an index that does not have an appropriate entry in the configuration file.


Apparently the dev server doesn't really check what it's indexing, it just blindly tries to create an index. So the index.yaml file in my case got the following entry:
 index.yaml
- kind: MyEntity
properties:
- name: !
- name: open
direction: desc


The entry "name: !" is not valid, so the DataStore dies. Fixing it is easy, just remove the invalid name entry, and restart the dev server. Easy!

-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.