GQL query with numeric id in datastore viewer

Viewed 13990

I want to build GQL query to get an object using its numeric id. I'm doing this in Datastore viewer in App management console, so I can't use Model.get_by_id(numeric_id). Something like

SELECT * FROM Model WHERE id = <numeric_id>

also doesn't work.

5 Answers

I was getting this error:

GQL Query error: Encountered ... at line 1, column 42. Was expecting one of: UNQUOTED_NAME ... QUOTED_NAME ..."

It turns out that in the Google AppEngine datastore developer's admin console, you should drop the quotes and use something like this:

SELECT * FROM MyEntity WHERE __key__ = Key(MyEntity, 5695872079757312)
Related