Skip to content

Total returns more values than expected (not applying distinct on count)  #674

Open
@Riya-900

Description

@Riya-900

Hi,

I have the tables Author and Books.

Author Book
Alice A
Alice B
Bob C

In my FastAPI endpoint, when paginating the select(Author).join(Books) I want to respond with a list that has 2 dicts:

  • Alice (with her two books)
  • Bob (with his one book)

It works great but the total is off. Instead of counting the unique Authors, it counts the total rows of the query.

Is there an option to fix that?

Perhaps relevant:

  • using FastAPI (+pydantic)
  • async PostgreSQL

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions