On Jun 29, 2012, at 9:58 AM, tonthon wrote:

> Hi,
> 
> I'm using the following (as discussed in another post) :
> 
> p1 = aliased(Project)
> 
> when using it in a filter :
> 
> query = session.query(Task).with_polymorphic([Invoice,
> Estimation]).outerjoin(p1, Invoice.project).outerjoin(p2,
> Estimation.project)
> query = query.filter(p1.company_id==cid)
> 
> I get the following error
> AttributeError: company_id
> 
> Since the Project class has a company_id Column defined in it, I was
> expecting I could access it in p1 as well.
> 
> Did I misunderstood something ?


if Project.company_id exists then p1.company_id should be there in just the 
same way.   Maybe test this more closely to confirm that it's specifically 
aliased(Project).company_id that's failing directly, and not as a result of 
query doing something internally.   Test case or at least full stack trace 
would illustrate for us here.




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en.

Reply via email to