From: Mike Bayer Date: Sun, 20 May 2007 18:22:48 +0000 (+0000) Subject: - restored logging of "lazy loading clause" under sa.orm.strategies logger, X-Git-Tag: rel_0_3_8~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a605c74fc02dd910ca03b879252b1e1acc82587;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - restored logging of "lazy loading clause" under sa.orm.strategies logger, got removed in 0.3.7 --- diff --git a/CHANGES b/CHANGES index e7938bdc85..74c818c150 100644 --- a/CHANGES +++ b/CHANGES @@ -37,6 +37,8 @@ - the "primary_key" argument to mapper() is propigated to the "polymorphic" mapper. primary key columns in this list get normalized to that of the mapper's local table. + - restored logging of "lazy loading clause" under sa.orm.strategies logger, + got removed in 0.3.7 - mysql - support for column-level CHARACTER SET and COLLATE declarations, as well as ASCII, UNICODE, NATIONAL and BINARY shorthand. diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py index f1b159318f..a1f88355de 100644 --- a/lib/sqlalchemy/orm/strategies.py +++ b/lib/sqlalchemy/orm/strategies.py @@ -166,6 +166,8 @@ class LazyLoader(AbstractRelationLoader): # determine if our "lazywhere" clause is the same as the mapper's # get() clause. then we can just use mapper.get() self.use_get = not self.uselist and query.Query(self.mapper)._get_clause.compare(self.lazywhere) + if self.use_get: + self.logger.info(str(self.parent_property) + " will use query.get() to optimize instance loads") def init_class_attribute(self): self._register_attribute(self.parent.class_, callable_=lambda i: self.setup_loader(i)) @@ -303,8 +305,7 @@ class LazyLoader(AbstractRelationLoader): li.traverse(secondaryjoin) lazywhere = sql.and_(lazywhere, secondaryjoin) - if hasattr(cls, 'parent_property'): - LazyLoader.logger.info(str(cls.parent_property) + " lazy loading clause " + str(lazywhere)) + LazyLoader.logger.info(str(prop.parent_property) + " lazy loading clause " + str(lazywhere)) return (lazywhere, binds, reverse) _create_lazy_clause = classmethod(_create_lazy_clause)