in optional-kubernetes-engine/bookshelf/model_cloudsql.py [0:0]
def list_by_user(user_id, limit=10, cursor=None):
cursor = int(cursor) if cursor else 0
query = (Book.query
.filter_by(createdById=user_id)
.order_by(Book.title)
.limit(limit)
.offset(cursor))
books = builtin_list(map(from_sql, query.all()))
next_page = cursor + limit if len(books) == limit else None
return (books, next_page)