The difference is between a Python class and an instance of that class.    
Class.attribute and object.attribute are two totally different things.  One 
represents SQL, the other your data.




On Apr 21, 2011, at 4:24 PM, RVince wrote:

> Are you sure? Because I can already access those fields from he mako
> page from that query -- shouldn't I be able to access them in the
> Puython controller of that page? -RVince
> 
> On Apr 21, 4:07 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> On Apr 21, 2011, at 12:48 PM, RVince wrote:
>> 
>>> Similarly, if I am doing an order_by:
>> 
>>> query =
>>> Session.query(SmartdataEligibilityRecord).order_by(SmartdataEligibilityReco 
>>> rd.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 
>>> athttp://groups.google.com/group/sqlalchemy?hl=en.- Hide quoted text -
>> 
>> - Show quoted text -
> 
> -- 
> 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