Just recently tried something like the following in the appengine interactive console:
from google.appengine.ext import db
from django.utils import simplejson
class TestDb(db.Model):
author = db.StringProperty()
def add(name):
t = TestDb()
t.author = name
t.put()
#added some names...
lst = db.GqlQuery("Select * from TestDb")
print [(x.key().id(), x.author) for x in lst]
I know for fact that ID is not sequential, but I assume it will be ascending in order for every new record that comes in.
Now I want to put a condition whose SQL would look something like:
SELECT * FROM TestDb WHERE ID > 2
Is this possible via GqlQuery()
?