3 ms·
Regarding the for loops I guess you mean the 1+N problem? The great thing about SA is that you can just change your loading strategy at any point to fix it with
by aidos 11y ago
Regarding the for loops I guess you mean the 1+N problem? The great thing about SA is that you can just change your loading strategy at any point to fix it without having to touch any other code.
q = db.query(P)
# add this later to fix your issues
# q = q.options(subqueryload('children'))
p = q.filter(P.id==73)
for c in p.children:
# oops, loads of db queries here
pass