Re: [SQLObject] multiple inheritance tree
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Diez B. R. <die...@ar...> - 2006-12-06 10:09:33
|
On Tuesday 05 December 2006 23:05, Oleg Broytmann wrote: > (Returning to the list...) > > On Tue, Dec 05, 2006 at 10:42:41PM +0100, Diez B. Roggisch wrote: > > Lets consider this hierarchy: > > > > class A: > > pass > > > > class B(A) > > pass > > > > class C(B) > > pass > > > > class D(B) > > pass > > > > class E(A): > > pass > > > > > > Now I have a page that shows all A, using > > > > A.select([some_filter_criteria]) > > > > Then the user can then select to e.g. only show C and E objects. > > > > So - what I need is a way to filter for the type of an object. So > > C.select() and E.select() isn't exactly what I want. Because then I'd > > have to recombine the results, including application of sorting criteria > > - instead of a single select that generates sql like this > > > > select ... from A, B, C, D, E where [join all tables by ids] and > > (B.childName =3D 'C' or A.childName =3D 'E') > > Soemthing like this: > > A.select(A.q.childName=3D=3D'B' && B.q.childName=3D=3D'C') > A.select(A.q.childName=3D=3D'B' && B.q.childName=3D=3D'C' && C.q.childNam= e=3D=3D'D' && > D.q.childName=3D=3D'E') Unfortunately, that is not working for me. Passing C.q.childName will creat= e a=20 clause that reads a.child_name. I'm digging into this - but if there is another solution, like creating=20 explicit table aliases to B and joining them with=20 A.id =3D B.id and then doing B.child_name =3D 'C' I'd be very happy. =2D-=20 >> Diez B. Roggisch >> Developer T +49 (30) 443 50 99 - 27 =46 +49 (30) 443 50 99 - 99 M +49 (179) 11 75 303 E die...@ar... >> artnology GmbH A Milastra=DFe 4 / D-10437 Berlin T +49 (30) 443 50 99 - 0 =46 +49 (30) 443 50 99 - 99 E in...@ar... I http://www.artnology.com |