[PonyORM-list] Retrieve 10 most recent related records
Dylan Staley
staley.dylan at gmail.com
Tue Nov 11 00:13:45 UTC 2014
Hi all! I'm using these two models:
class Person(db.Entity):
id = PrimaryKey(int, auto=True)
checkouts = Set("Checkout")
@property
def recent_checkouts(self):
# return 10 most recent checkouts
class Checkout(db.Entity):
id = PrimaryKey(int, auto=True)
person = Required(Person)
date = Required(date)
I'd like to be able to call Person.recent_checkouts to get a list of that
person's ten most recent checkouts. How would I accomplish this in the most
performant manner?
Best,
Dylan Staley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20141111/4af52e8b/attachment.html>
More information about the ponyorm-list
mailing list