diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-08-14 03:34:38 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-08-14 03:34:38 +0000 |
| commit | 6c6cd47c024c5ea2cada04534aca818f95b8ea8c (patch) | |
| tree | bbdb86a8eddc32cb2548a309146106e4d2026b62 | |
| parent | b9ed823528ef88fb0dc64120e1e501306f4c3768 (diff) | |
| download | sqlalchemy-6c6cd47c024c5ea2cada04534aca818f95b8ea8c.tar.gz | |
- fixed endless loop
- fixed perf imports in masseagerload
| -rw-r--r-- | lib/sqlalchemy/orm/session.py | 5 | ||||
| -rw-r--r-- | test/perf/masseagerload.py | 1 | ||||
| -rw-r--r-- | test/testlib/__init__.py | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index f8589dbe4..7e9b351e1 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -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)) diff --git a/test/perf/masseagerload.py b/test/perf/masseagerload.py index f1c0f292b..ad438c1fa 100644 --- a/test/perf/masseagerload.py +++ b/test/perf/masseagerload.py @@ -1,5 +1,4 @@ import testbase -import hotshot, hotshot.stats from sqlalchemy import * from sqlalchemy.orm import * from testlib import * diff --git a/test/testlib/__init__.py b/test/testlib/__init__.py index bfc2ba04b..046f8f9b4 100644 --- a/test/testlib/__init__.py +++ b/test/testlib/__init__.py @@ -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') |
