While creating, updating, and deleting are fairly straightforward operations, the real fun starts when we look at ways to retrieve our entries. We'll start with the basics, and then work our way up to more interesting queries.
We will use a special attribute on our model class to make queries:
Entry.query. This attribute exposes a variety of APIs for working with the collection of entries in the database.
Let's simply retrieve a list of all the entries in the
In : entries = Entry.query.all() In : entries # What are our entries? Out: [<Entry u'First entry'>, <Entry u'Second entry'>, <Entry u'Third entry'>, <Entry u'Fourth entry'>]
As you can see, in this example the query returns a list of
Entry instances ...