]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fixed endless loop
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Aug 2007 03:34:38 +0000 (03:34 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Aug 2007 03:34:38 +0000 (03:34 +0000)
- fixed perf imports in masseagerload

lib/sqlalchemy/orm/session.py
test/perf/masseagerload.py
test/testlib/__init__.py

index f8589dbe42445adc52cec2f5772da8e714d2e12d..7e9b351e1485f15b5c836ded1b250e03af73579b 100644 (file)
@@ -148,7 +148,8 @@ class SessionTransaction(object):
         self.nested = nested
 
     def connection(self, bindkey, **kwargs):
-        return self.session.connection(bindkey, **kwargs)
+        engine = self.session.get_bind(bindkey, **kwargs)
+        return self.get_or_add(engine)
 
     def _begin(self, **kwargs):
         return SessionTransaction(self.session, self, **kwargs)
@@ -623,6 +624,8 @@ class Session(object):
         else:
             if isinstance(mapper, type):
                 mapper = _class_mapper(mapper)
+            else:
+                mapper = mapper.compile()
             e = mapper.mapped_table.bind
             if e is None:
                 raise exceptions.InvalidRequestError("Could not locate any Engine or Connection bound to mapper '%s'" % str(mapper))
index f1c0f292b0e5f75d17fa027bf9f6dc571431394f..ad438c1faa195185c61a2eb8168f7736fc109155 100644 (file)
@@ -1,5 +1,4 @@
 import testbase
-import hotshot, hotshot.stats
 from sqlalchemy import *
 from sqlalchemy.orm import *
 from testlib import *
index bfc2ba04b2f3a8f2688cf4431e4850bd2a2e4ed3..046f8f9b407139923858363eef4c6d10e57b9589 100644 (file)
@@ -7,10 +7,10 @@ import testlib.config
 from testlib.schema import Table, Column
 import testlib.testing as testing
 from testlib.testing import PersistTest, AssertMixin, ORMTest, SQLCompileTest
-import testlib.profiling
+import testlib.profiling as profiling
 import testlib.engines
 
 
 __all__ = ('testing',
            'Table', 'Column',
-           'PersistTest', 'AssertMixin', 'ORMTest', 'SQLCompileTest')
+           'PersistTest', 'AssertMixin', 'ORMTest', 'SQLCompileTest', 'profiling')