first u get your query sorted in proper order (by timestamp or even dbid, or hierarchicaly via subselect + groupby + order, whatever) then yourquery[:1000] On Wednesday 24 September 2008 14:11:24 Heston James - Cold Beans wrote: > Morning Guys, > > > > I hope this'll be a fairly simple question. I have a query which > looks something like this: > > > > the_objects = > session.query(myobject.myobject).filter("myobject.created > > :lastrecord").params(lastrecord=time.strftime("%Y-%m-%d %H:%M:%S", > from_date)).all() > > > > This grabs all the records after a particular date and time. What I > WANT it to achieve though is to grab the first 1000 records that > happen after a period in time. How would you suggest that I handle > my limits and order_by's on this? It's important that no records > get missed out you see so I need to be totally sure that the 1000 > records returned are the first 1000 records in chronological order > after 'from_date'. > > > > I'm using SQLAclchemy 0.5 and MySQL 5 > > > > I appreciate any advice you can offer. > > > > Cheers, > > > > Heston > > >
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---