Skip to content

Comments

Better performance on Pagination().total#583

Closed
Quanr wants to merge 1 commit intopallets-eco:masterfrom
Quanr:pagination
Closed

Better performance on Pagination().total#583
Quanr wants to merge 1 commit intopallets-eco:masterfrom
Quanr:pagination

Conversation

@Quanr
Copy link

@Quanr Quanr commented Jan 11, 2018

@trancee
Copy link

trancee commented Aug 23, 2018

@Quanr I think you are using the wrong func from SQLAlchemy. I usually import it like this:

from sqlalchemy import func

And your code change should then look like this:

    total = self.session.execute(
        self.statement.with_only_columns(
            [func.count()]
        ).order_by(None)).scalar()

Otherwise I think this pull request should be merged into the code base.

@rsyring rsyring added this to the 3.x milestone Mar 9, 2019
@davidism
Copy link
Member

Closing for the same reasons discussed in the closed linked PR.

@davidism davidism closed this May 26, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2020
@davidism davidism removed this from the 3.x milestone Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

4 participants