3 ms·
this has been a solved problem for... a long time, can't remember how long even. https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html#preventing
by baq 2y ago
this has been a solved problem for... a long time, can't remember how long even.
https://docs.sqlalchemy.org/en/20/orm/queryguide/relationships.html#preventing-unwanted-lazy-loads-using-raiseload https://docs.sqlalchemy.org/en/20/orm/queryguide/relationshi...
the older I get the more I'm convinced this should be the default behavior.
- GolDDranks 2y agoI think you are talking past each others. Preventing N+1 by doing lazy fetching and having synchronous / asynchronous API are orthogonal issues. Async API must not block the thread/event loop when the data loading is being done. Diesel hasn't been providing an async API for reason told in this thread: https://github.com/diesel-rs/diesel/issues/399 https://github.com/diesel-rs/diesel/issues/399 The situation might change some day though, once async support in the core language and surrounding ecosystem gets stronger.
- satvikpendem 2y agodiesel_async exists and is also maintained by the same creator.
- GolDDranks 2y agoYes, but it started as a experiment, and isn't official part of Diesel yet.
- satvikpendem 2y agoThe creator said it is production ready, and that it will never be "officially" part of diesel as diesel only supports a sync interface. Nevertheless, diesel_async is fully fine to use, he mentions.