like this one...this does your generating thing. but much easier to understand, since the actual "test" is clearly spelled out:
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/test/orm/ abc_inheritance.py On Feb 27, 2007, at 4:17 PM, [EMAIL PROTECTED] wrote: > hallo. > AFAIsee rev 2362 fixes the lazy-load for polymorphic properties. > but is seems to introduce another problem.. or maybe uncover it. > > table-inheritance, A<-B<-C<-D, and A has reference to B. > > 2361: lazy-ref is loaded wrong > ... > File "/home/az/src/hor-trunk/db/sawrap/tests/sa_gentestbase.py", > line 109, in query1 > klas.__name__+'.getby_'+idname+'():\n result= %(q)s\n > expect= %(exp_single)s' % locals() > AssertionError: A.getby_db_id(): > result= A( db_id=1 linkA=>cc name=anna ) > expect= A( db_id=1 linkA=>ben name=anna ) > > > 2362: cannot compile mapper A: > ... (inside obj-ctor / mapper compilation) ... > File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/properties.py", > line 341, in _create_polymorphic_joins > raise exceptions.AssertionError("Could not find corresponding > column for " + str(c) + " in selectable " + > str(self.mapper.select_table)) > > AssertionError: Could not find corresponding column for B.db_id in > selectable SELECT "bz4C".db_id, "bz4C".name, CAST(NULL AS TEXT) > AS "dataD", "bz4C"."linkA_id", "bz4C".atype, "bz4C"."dataC", > "bz4C"."dataB" > FROM (SELECT "A"."linkA_id" AS "linkA_id", "A".name AS name, "A".db_id > AS db_id, "A".atype AS atype, "B"."dataB" AS "dataB", "C"."dataC" > AS "dataC" > FROM "A" JOIN "B" ON "B".db_id = "A".db_id JOIN "C" ON "C".db_id > = "B".db_id > WHERE "A".atype = ?) AS "bz4C" UNION ALL > SELECT "bz4B".db_id, "bz4B".name, CAST(NULL AS TEXT) > AS "dataD", "bz4B"."linkA_id", "bz4B".atype, CAST(NULL AS TEXT) > AS "dataC", "bz4B"."dataB" > FROM (SELECT "A"."linkA_id" AS "linkA_id", "A".name AS name, "A".db_id > AS db_id, "A".atype AS atype, "B"."dataB" AS "dataB" > FROM "A" JOIN "B" ON "B".db_id = "A".db_id > WHERE "A".atype = ?) AS "bz4B" UNION ALL > SELECT "D".db_id, "A".name, "D"."dataD", "A"."linkA_id", "A".atype, > "C"."dataC", "B"."dataB" > FROM "A" JOIN "B" ON "B".db_id = "A".db_id JOIN "C" ON "C".db_id > = "B".db_id JOIN "D" ON "D".db_id = "C".db_id > > FYI, This behaviour happens if A points to a heir of itself of level > <= max-2; e.g. in the case of A-B-C-D-E-F, A pointing to any of B,C,D > would raise the above, and will not error for A,E,F. Or something > alike. > > =============== > ciao > svil > > > > <_test-ABCD-t.py> > <sa_gentestbase.py> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---