Hi,
You can do SampleModel.filter('__key__ >', db.Key.from_path('SampleModel',
50)).Bear in mind, however, that App Engine makes no guarantees about sequentiality or ordering for datastore key IDs. -Nick Johnson On Wed, Jan 6, 2010 at 12:58 AM, B. Suchland <[email protected]> wrote: > I was wondering if anyone knew if it is possible, given the id of a > specific database entry (eg 50), to fetch all entries from the same > database model with a higher id (In this case anything above 50) using > only a single database hit. > > In other words, is there any way to do the equivalent of this invalid > query: > > SampleModel.gql('WHERE id > 50') > > I have seen solutions where the id of an entry is stored as a separate > string property as follows, but this requires two database writes and > leaves a small window of time in between the two where the id field is > empty: > > sm = SampleModel() > sm.put() > sm.id = sm.key().id() > sm.put() > > I have also seen a proposed solution using get_by_id() with a list of > ids starting at 50 as an argument, but I was hoping to find a solution > that did not require me to be aware of the number of possible entries > beyond the one with the id of 50. > > Any help would be greatly appreciated! > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > > > -- Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
