From: Torsten Werner Date: Tue, 18 Jan 2011 21:05:03 +0000 (+0100) Subject: Carefully add a backref from PoolFile to Location. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=0033592f3a939316a8e6946d4f05df04a6e0a774;p=dak.git Carefully add a backref from PoolFile to Location. 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 --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 93ec1172..75e56cd9 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2945,7 +2945,11 @@ class DBConn(object): 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,