diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-07-12 20:19:32 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-07-12 20:19:32 +0000 |
commit | 7cb8f04f48eed7afd5befe2ce00ea3771ea79b40 (patch) | |
tree | 0455f09d259d2f3637b8f70a20725db3599ae655 | |
parent | 5d599314d567dcf9edbcf6c6c662a3fd5e83c042 (diff) | |
download | sqlalchemy-7cb8f04f48eed7afd5befe2ce00ea3771ea79b40.tar.gz |
still having mappers not getting compiled...sigh...
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/query.py | 2 | ||||
-rw-r--r-- | test/orm/polymorph.py | 20 |
3 files changed, 21 insertions, 2 deletions
@@ -7,6 +7,7 @@ of subclassed directly. activated when activemapper is imported - small fix to URL regexp to allow filenames with '@' in them - fixes to Session expunge/update/etc. +- select_table mappers *still* werent always compiling 0.2.5 - fixed endless loop bug in select_by(), if the traversal hit diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index 985659eec..2b257e716 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -17,7 +17,7 @@ class Query(object): self.mapper = mapper.class_mapper(class_or_mapper, entity_name=entity_name) else: self.mapper = class_or_mapper.compile() - self.mapper = self.mapper.get_select_mapper() + self.mapper = self.mapper.get_select_mapper().compile() self.always_refresh = kwargs.pop('always_refresh', self.mapper.always_refresh) self.order_by = kwargs.pop('order_by', self.mapper.order_by) diff --git a/test/orm/polymorph.py b/test/orm/polymorph.py index ec7e95a0a..232bc5711 100644 --- a/test/orm/polymorph.py +++ b/test/orm/polymorph.py @@ -85,7 +85,25 @@ class MultipleTableTest(testbase.PersistTest): def test_t_t_t(self): self.do_test(True, True, True) - + def testcompile(self): + person_join = polymorphic_union( { + 'engineer':people.join(engineers), + 'manager':people.join(managers), + 'person':people.select(people.c.type=='person'), + }, None, 'pjoin') + + person_mapper = mapper(Person, people, select_table=person_join, polymorphic_on=person_join.c.type, polymorphic_identity='person') + mapper(Engineer, engineers, inherits=person_mapper, polymorphic_identity='engineer') + mapper(Manager, managers, inherits=person_mapper, polymorphic_identity='manager') + + session = create_session() + session.save(Manager(name='Tom', status='knows how to manage things')) + session.save(Engineer(name='Kurt', status='knows how to hack')) + session.flush() + print session.query(Engineer).select() + + print session.query(Person).select() + def do_test(self, include_base=False, lazy_relation=True, redefine_colprop=False): """tests the polymorph.py example, with several options: |