I am using sqlalchemy query with limit and offset. Now I need to get the total count of the query result.
For now I am using count query and limit query separately and getting the results. Is there any efficient way to get the count in a single sqlalchemy query.
Here is the sample of currently what I am using,
# getting total count
docs_count = DB_SESSION.query(Documents).count()
# using limit and offset
docs_list = DB_SESSION.query(Documents).limit(10).offset(0)
Now is it possible to combine this into a single query, or there any efficient method to do this. Thanks all.