Counting records
You can count the number of rows in any select query:
- >>> Tweet.select().count()
- 100
- >>> Tweet.select().where(Tweet.id > 50).count()
- 50
Peewee will wrap your query in an outer query that performs a count, whichresults in SQL like:
- SELECT COUNT(1) FROM ( ... your query ... );