AZMel wrote:

> Ok I'm beginning to understand the SQL Model now and I am able to run
> a query using
>
>               records =
> SubDivision.query().join('divisionJoin').select()
>
> [snip, snip...]
>
> Why does it not return the fields in Division?

You are performing a query against a mapped object, which will always
return a list of instances that match your query constraints.  If you
want to get back a list of *fields* from multiple different entities,
you are going to want to perform a more low-level operation that will
explicitly request back the fields that you care about, like so:

     from sqlalchemy import select

     results = select(
         [
             SubDivision.c.Subdivision_id,
             SubDivision.c.Name,
             SubDivision.c.DisplayOrder,
             Division.c.Division_id,
             Division.c.Name
         ],
         SubDivision.c.Division_id==Division.c.Division_id
     ).execute()

     for result in results:
         print result

I hope this helps you out!

--
Jonathan LaCour
http://cleverdevil.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to