Hi, I was looking at this bug fix, and I couldn't figure out where part 2 of the problem was actually fixed.
If you can ignore the absurdity of this example, it shows a situation where the second problem still appears to exist: from sqlalchemy import * from sqlalchemy.orm import * metadata = MetaData("mysql://mrlabs:[EMAIL PROTECTED]:3306/test") metadata.bind.echo=True table = Table("test", metadata, Column("id", Integer, primary_key=True), Column("other_id", Integer), Column("active", Boolean)) table2 = Table("test2", metadata, Column("id", Integer, primary_key=True), Column("other_id", Integer), Column("active", Boolean)) table.create() table.insert().execute([{"other_id":1, "active": False}, {"other_id": 2, "active": True}]) table2.create() table2.insert().execute([{"other_id":1, "active": False}, {"other_id": 2, "active": True}]) test = table.select(table.c.active).alias("test") class Test(object): pass class Test2(object): pass mapper(Test, table) mapper(Test2, table2) session = create_session() q = join(table, table2, table2.c.other_id == table.c.id) s = q.select(use_labels=True).alias("inner_query") s2 = s.select(use_labels=True).alias("outer_query") print session.query(Test, Test2).instances(s2.execute(use_labels=True)) for which I get the output: 2007-12-14 00:27:59,637 INFO sqlalchemy.engine.base.Engine.0x..30 SELECT inner_query.test_id AS inner_query_test_id, inner_query.test_other_id AS inner_query_test_other_id, inner_query.test_active AS inner_query_test_active, inner_query.test2_id AS inner_query_test2_id, inner_query.test2_other_id AS inner_query_test2_other_id, inner_query.test2_active AS inner_query_test2_active FROM (SELECT test.id AS test_id, test.other_id AS test_other_id, test.active AS test_active, test2.id AS test2_id, test2.other_id AS test2_other_id, test2.active AS test2_active FROM test JOIN test2 ON test2.other_id = test.id) AS inner_query 2007-12-14 00:27:59,637 INFO sqlalchemy.engine.base.Engine.0x..30 [] Traceback (most recent call last): File "test2.py", line 41, in ? print session.query(Test, Test2).instances(s2.execute(use_labels=True)) File "/Users/david/working/env_dandd/lib/python2.4/SQLAlchemy-0.3.11- py2.4.egg/sqlalchemy/orm/query.py", line 1047, in instances self.select_mapper._instance(context, row, result) File "/Users/david/working/env_dandd/lib/python2.4/SQLAlchemy-0.3.11- py2.4.egg/sqlalchemy/orm/mapper.py", line 1443, in _instance identitykey = self.identity_key_from_row(row) File "/Users/david/working/env_dandd/lib/python2.4/SQLAlchemy-0.3.11- py2.4.egg/sqlalchemy/orm/mapper.py", line 950, in identity_key_from_row return (self.class_, tuple([row[column] for column in self.pks_by_table[self.mapped_table]]), self.entity_name) File "/Users/david/working/env_dandd/lib/python2.4/SQLAlchemy-0.3.11- py2.4.egg/sqlalchemy/engine/base.py", line 1172, in __getitem__ return self.__parent._get_col(self.__row, key) File "/Users/david/working/env_dandd/lib/python2.4/SQLAlchemy-0.3.11- py2.4.egg/sqlalchemy/engine/base.py", line 993, in _get_col rec = self._convert_key(key) File "/Users/david/working/env_dandd/lib/python2.4/SQLAlchemy-0.3.11- py2.4.egg/sqlalchemy/engine/base.py", line 930, in _convert_key raise exceptions.NoSuchColumnError("Could not locate column in row for column '%s'" % (str(key))) sqlalchemy.exceptions.NoSuchColumnError: "Could not locate column in row for column 'test.id'" This is from a checkout of the rel_0_3 branch rev 3936. Thanks, David On Oct 17, 7:07 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Oct 17, 2007, at 4:07 AM, klaus wrote: > > > > > Thanks a lot! The solution is so simple that I feel a little > > embarassed... > > im embarrased that bug's been present for so long ! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---