josiahcarlson/rom — pull request #33 by Alanperd (2014-06-18 13:12:16+00:00)
Title: Get rows count in all mehtod (one call)

Hello again Josiah,

I am gonna explain you in a few lines the problem and the adopted solution.

In the project which we are carrying out , the need to make data paging operations through Redis has come out.

Now making use of ROM, I have to make two queries. The first, to get the information but I have to specify a rows limit. (For example, “Person.query.filter(age=20).limit(0,2).all()”). The second, I need to get the total of rows affected by the query, so I have to make the following query “Person.Query.filter(age=20).count()”. This operation runs again the same query over Redis and it penalizes the performance for each paging operation.

To improve in this aspect I have made a change in the code which allows to get the number of rows in one call.

“Person.query.filter(age=20).all(rowcount=countperson)”.

Thanks a lot for all¡¡.

Regards,
Alberto.