Often I'm at the shell and want to quickly pull up the most recent entry in a table. I wrote a couple of helpers for this.
For instance, in a blog app: db.posts.last() ...will get the most recent post. By putting this code at the bottom of db.py, it'll automatically create a first() and last() method for each table in your app. for table in db.tables: def first(self): return db(self.id>0).select(orderby=self.id, limitby=(0,1)).first() def last(self): return db(self.id>0).select(orderby=~self.id, limitby=(0,1)).first() t = db[table] t.first = types.MethodType(first, t) t.last = types.MethodType(last, t)