bojanb wrote:
> mapper(Book, books)
> mapper(Author, authors, properties={
>     'books': relation(Book, secondary=book_authors,
> backref='authors'),
>     'book_count': column_property(select([func.count(books.c.id)],
> book_authors.c.author_id==books.c.id).label('books_count'))
>     })
>

the subquery within the column property is not joined to the parent table
"authors".  It needs to join book_authors back to the authors table using
AND.  the subquery will automatically correlate outwards to the "authors"
query so "authors" would only render in the outermost FROM (which is what
you want).



--~--~---------~--~----~------------~-------~--~----~
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