We use https://github.com/samuelcolvin/buildpg, which is built by the same dude that built pydantic, which is also used in FastAPI.
It's neat, it's a query builder, not an ORM or any nonsense, and it makes queries a lot more manageable (bringing SQL logic into python primitives).