Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should count() default to wrapped_count() when query contains a limit or offset? #405

Closed
bryhoyt opened this issue Jul 23, 2014 · 3 comments

Comments

@bryhoyt
Copy link
Contributor

bryhoyt commented Jul 23, 2014

As far as I can tell, count() returns meaningless results when the query contains a limit or offset (neither the total, nor the limited, number of results).

As per the docs, "count() will automatically default to wrapped_count() in the event the query is distinct or has a grouping".

I think that's nice; exactly what you want in the case of distinct or group by. Wouldn't it make sense for it to do the same if the query has a limit or offset?

If not, what's the rationale behind that?

@bryhoyt
Copy link
Contributor Author

bryhoyt commented Jul 23, 2014

Additionally, I think count() should have a clear_limit parameter which it passes through to wrapped_count() -- I'm mentioning this as a comment here, not a separate issue, because it would only make sense if count deferred to wrapped_count for limits and offsets.

@coleifer
Copy link
Owner

I think that's nice; exactly what you want in the case of distinct or group by. Wouldn't it make sense for it to do the same if the query has a limit or offset?

Yeah, now that I think about it I agree.

@bryhoyt
Copy link
Contributor Author

bryhoyt commented Jul 24, 2014

Thanks, looks great -- really appreciate the quick fixes. I'm loving using Peewee with Flask -- thanks for the great ORM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants