|
|
|
|
|
by bulatb
445 days ago
|
|
Just a heads-up if you haven't seen it: Overriding lazy-loading options at query time can help with overfetching. class Author(Model):
books = relationship(..., lazy='select')
fetch_authors = select(Author).options(raiseload(Author.books))
Anything that gets its Authors with fetch_authors will get instances that raise instead of doing a SELECT for the books. You can throw that in a smoke test and see if there's anything sneaking a query. Or if you know you never want to lazy-load, relationship(..., lazy='raise') will stop it at the source.https://docs.sqlalchemy.org/en/20/orm/queryguide/relationshi... |
|