GQL query with numeric id in datastore viewer

Pawel Markowski picture Pawel Markowski · Oct 6, 2010 · Viewed 13.3k times · Source

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.

Answer

Saxon Druce picture Saxon Druce · Oct 6, 2010

Try this:

SELECT * FROM Model where __key__ = KEY('Model', <numeric_id>)