Using lazy='dynamic' makes sure that property Location.files is not a very huge
list but a query object that can be iterated or .filter()-ed.
Signed-off-by: Torsten Werner <twerner@debian.org>
properties = dict(file_id = self.tbl_files.c.id,
filesize = self.tbl_files.c.size,
location_id = self.tbl_files.c.location,
properties = dict(file_id = self.tbl_files.c.id,
filesize = self.tbl_files.c.size,
location_id = self.tbl_files.c.location,
- location = relation(Location)))
+ location = relation(Location,
+ # using lazy='dynamic' in the back
+ # reference because we have A LOT of
+ # files in one location
+ backref=backref('files', lazy='dynamic'))))
mapper(Fingerprint, self.tbl_fingerprint,
properties = dict(fingerprint_id = self.tbl_fingerprint.c.id,
mapper(Fingerprint, self.tbl_fingerprint,
properties = dict(fingerprint_id = self.tbl_fingerprint.c.id,