Reputation: 4825
I only need to get the number of rows from the peewee database. I know that .count
or .wrapped_count
can be executed in a query.
num_of_rows = Video.select().wrapped_count()
I need to execute a select query to get the number of rows. Does it affect performance and is there any method or field that I can use to get how many rows exist in the database?
In raw SQL query, I could write it like this.
SELECT COUNT(*) FROM video;
Upvotes: 2
Views: 2449
Reputation: 26245
Video.select().count()
Issues a SELECT COUNT(1) FROM video
query.
Upvotes: 4