[sqlalchemy] Re: Cannot use add_entity to add result from subquery?

2009-07-15 Thread The Devil's Programmer
ok so the problem was that I was just calling query.add_column() without grabbing the result, ie.. query = query *facepalm* rookie mistake On Jul 15, 10:41 am, The Devil's Programmer thedevilsprogram...@gmail.com wrote: here is my code http://pastebin.com/m13075cc9 if that helps On

[sqlalchemy] Re: Cannot use add_entity to add result from subquery?

2009-07-14 Thread Michael Bayer
The Devil's Programmer wrote: I can do this - comment_count_subquery = meta.Session.query(Comment.article_id, func.count('*').label('article_comment_count')).group_by (Comment.article_id).subquery() query = meta.Session.query(Article, comment_count_subquery.c.article_comment_count) but

[sqlalchemy] Re: Cannot use add_entity to add result from subquery?

2009-07-14 Thread Michael Bayer
The Devil's Programmer wrote: using add_column does not seem to work the same as including both items in the query [like below] query = meta.Session.query(Article, comment_count_subquery.c.article_comment_count) it does not return an iterable result is there any way to add subqueries to

[sqlalchemy] Re: Cannot use add_entity to add result from subquery?

2009-07-14 Thread The Devil's Programmer
well instead of returning an iterable array of Articles, its just returning a single Article On Jul 15, 10:17 am, Michael Bayer mike...@zzzcomputing.com wrote: The Devil's Programmer wrote: using add_column does not seem to work the same as including both items in the query [like below]

[sqlalchemy] Re: Cannot use add_entity to add result from subquery?

2009-07-14 Thread The Devil's Programmer
here is my code http://pastebin.com/m13075cc9 if that helps On Jul 15, 10:22 am, The Devil's Programmer thedevilsprogram...@gmail.com wrote: well instead of returning an iterable array of Articles, its just returning a single Article On Jul 15, 10:17 am, Michael Bayer