You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/repository/repository.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,3 +94,16 @@ using either approach:
94
94
95
95
Note that `AsyncSession` has [the same limitation on lazy loading](https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html#asyncio-orm-avoid-lazyloads),
96
96
even when keeping the session opened, so it makes sense that the two Repository implementations behave consistently.
97
+
98
+
/// details | Lazy loading using `AsyncAttrs`
99
+
100
+
SQLAlchemy has recently added the `AsyncAttrs` model class mixin to allow lazy loading model attributes
101
+
with `AsyncSession`, however having to `await` a model property introduce a coupling between the
102
+
application logic and the storage layer.
103
+
104
+
This would mean the application logic has to know about the storage layer and make a distinction
105
+
between sync and async models. This doesn't feel right, at least for now,
106
+
therefore it's not enabled by default.
107
+
108
+
If you want to attempt lazy loading refer to [SQLAlchemy documentation](https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html#synopsis-orm)
0 commit comments