On Apr 21, 2011, at 12:48 PM, RVince wrote:

> Similarly, if I am doing an order_by:
> 
> query =
> Session.query(SmartdataEligibilityRecord).order_by(SmartdataEligibilityRecord.member.middle_initial.desc()).all()

place the Member class in the order_by() clause after constructing a join() to 
SmartRecord.member.   

Examples of joins are in the ORM tutorial at:

http://www.sqlalchemy.org/docs/orm/tutorial.html#querying-with-joins



> 
> It returns:
> 
> Error - <type 'exceptions.AttributeError'>: Neither
> 'InstrumentedAttribute' object nor 'Comparator' object has an
> attribute 'middle_initial'
> 
> In this kind of circumstance of joined tables, in the python code
> itself (the Pylons controller, actually) how would I refer to the
> member table's middle_initial field where the members table is joined
> in with a left outer join via SQLAlchemy? Thanks again
> 
> -RVince
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to