From 0033592f3a939316a8e6946d4f05df04a6e0a774 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Tue, 18 Jan 2011 22:05:03 +0100 Subject: [PATCH] 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 --- daklib/dbconn.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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, -- 2.39.2