Re: [Sqlalchemy-tickets] [sqlalchemy] #2796: Labeled subqueries
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-08-06 09:42:33
|
#2796: Labeled subqueries
----------------------------------+------------------------------------
Reporter: kvesteri | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone:
Component: sql | Severity: no triage selected yet
Resolution: | Keywords:
Progress State: awaiting triage |
----------------------------------+------------------------------------
Comment (by kvesteri):
I was able to bypass this problem by forcing the subquery to render itself
as string before passing it to from_obj. This introduces other problems
because then I can't use SQLAlchemy's correlated subqueries for example.
{{{#!python
company_ids = db.select([Company.id], from_obj=Company.__table__)
print db.session.execute(db.select([db.func.count(db.distinct('id'))],
from_obj=unicode(company_ids.label('company_ids'))))
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2796#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|