← Back to team overview

caneypuggies team mailing list archive

Filtering results of a SQLAlchemy query

 

Here's how to filter results returned by a SQLAlchemy query:

page = DBSession.query(Page).filter_by(pagename=pagename).one()

That returns one page.

pages = DBSession.query(Page).filter_by(pagename=pagename)

That would return all pages with that page name.

This code is found in the Wiki tutorial which is a good thing to work
through to learn how TurboGears fits together:

http://www.turbogears.org/2.1/docs/main/Wiki20/wiki20.html

Tim