I really have no idea how this test works, i cant understand what  
conditions are being tested when you say

             expects = [
                 dict( klas= A, table= table_A, oid= a.db_id,  
exp_single= str(a),
                         exp_multi = [ str(a), str(b), str(c) ]),
                 dict( klas= B, table= table_B, oid= b.db_id,  
exp_single= str(b),
                         exp_multi = [ str(b), str(c) ]),
                 dict( klas= C, table= table_C, oid= c.db_id,  
exp_single= str(c),
                         exp_multi = [ str(c) ]),

             ]

and im generally fairly uninterested in A->B->C->D inheritance in a  
database, so youll have to put some more effort into breaking this  
problem down into something simple and readable and also with all  
extraneous conditions removed (such as, if you remove the B and C  
polymorphic joins it still fails - please make that effort for me),  
because i really dont have time to decode these tests.


On Feb 27, 2007, at 3: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
-~----------~----~----~----~------~----~------~--~---

Reply via email to