Closed sqlalchemy-bot closed 17 years ago
Michael Bayer (zzzeek) wrote:
Michael Bayer (zzzeek) wrote:
its far clearer to just use regular python instead of implicit magic:
for car in personInstance.cars:
for accident in car.accidents:
print accident
if youre concerned about excessive selects, thats what eager loading / result set mapping is for.
Anonymous wrote:
Testing script
Changes by Michael Bayer (zzzeek): set state to "wontfix"
Changes by Michael Bayer (zzzeek): set milestone to "blue sky"
Changes by Michael Bayer (zzzeek): changed priority from "critical" to "minor"
Changes by Anonymous: set attachment to "447.py"
Issue created by Anonymous
Like in the file I will attach (inspired by #441), let's have persons that may have cars that may have accidents (person 1---N car 1 ---N accident). Person has a property named "cars" and car a property named "accidents" (self-explaining I guess).
I would like to have the possibility to fetch the accidents of one person using:
It is not possible now (at least, using this syntax and in only one select) because "cars" is a simple list. Maybe using a more intelligent and iterable structure?
Attachments: 447.py