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

count() doesn't work properly using UNION #886

Closed
tarot231 opened this issue Mar 13, 2016 · 1 comment
Closed

count() doesn't work properly using UNION #886

tarot231 opened this issue Mar 13, 2016 · 1 comment

Comments

@tarot231
Copy link

Hello,

following code currently doesn't work properly.

q = (q1 | q2)
print(q.count())

I tested to modify peewee.py as follows.

    def count(self, clear_limit=False):
        if self._distinct or self._group_by or self._limit or self._offset or \
                isinstance(self, CompoundSelect):
            return self.wrapped_count(clear_limit=clear_limit)

And then it went well.
Please confirm whether this is right.

@coleifer
Copy link
Owner

Thank you, fixed.

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