On Mon, Mar 10, 2008 at 3:12 AM, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
> On Sun, Mar 09, 2008 at 08:52:28PM -0700, Daniel Fetchinson wrote:
> > class zoo( SQLObject ):
> > cages = MultipleJoin( 'cage' )
> >
> > class cage( SQLObject ):
> > zoo = ForeignKey( 'zoo' )
> > animals = MultipleJoin( 'animal' )
> > properties = RelatedJoin( 'property' )
> >
> > class animal( SQLObject ):
> > cage = ForeignKey( 'cage' )
> > properties = RelatedJoin( 'property' )
> >
> > class property( SQLObject ):
> > animals = RelatedJoin( 'animal' )
> > cages = RelatedJoin( 'cage' )
> >
> >
> > What would be the select call for selecting all properties for a given
> > zoo instance?
>
> SQLObject cannot automagically construct such a comple SQL query. You
> can do it in Python:
>
> z = zoo.get(id)
> zoo_properties = []
> for c in z.cages:
> for a in c.animals:
> for p in a.properties:
> zoo_properties.append(p)
>
>
>
Thanks, this is the approach I had so far, but I thought some clever join
construction would do it if done right.
Cheers,
Daniel
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss