im committing something that will make that exact phrase work (its in
rev 5734). using a released version of SQLA, for now say
id.in_(query.statement).
I took at look at those changes and they look awesome! If I understand
the changes correctly, however, then I wonder what purpose
it still is needed if you explicitly need an alias() of your SELECT
statement. joining to it, embedding it within aliased().haven't
figured out yet if there's some way to make it automatic in all
cases or if thats appropriate.
also more controverially im thinking of adding a .c. to
I think you have to use group by with a count(). Something like
Account.query.join(Account.users).group_by(Account.id).filter(func.count(User.id)
1)
On Mon, Jan 26, 2009 at 12:59 PM, Jon Nelson jnel...@jamponi.net wrote:
Let's assume I have a 1:many relationship between Accounts and Users.
If I try that, I get:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) aggregates not
allowed in WHERE clause
The SQL generated is:
SELECT account.accountid AS account_accountid
FROM account
JOIN userinfo ON account.accountid = userinfo.accountid
WHERE count(userinfo.userid) %(count_1)s
On Mon, Jan 26, 2009 at 5:21 PM, Jon Nelson jnel...@jamponi.net wrote:
...
If I start with this subquery:
q0 = s.query(Account.accountid,
sa.func.count(User.userid).label('user_count'))
.join(Account.users)
.group_by(Account.accountid)
.having(sa.func.count(User.userid)1)
On Jan 26, 2009, at 6:21 PM, Jon Nelson wrote:
If I try that, I get:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) aggregates not
allowed in WHERE clause
The SQL generated is:
SELECT account.accountid AS account_accountid
FROM account
JOIN userinfo ON account.accountid =
I assumed it was a bug due to the presence of a python-style string
substitution.
...
another option is
sess.query(Account).filter(Account.id.in_(your subquery)).
When I do it that way, I get crazy SQL and an error. Using
Account.accountid to shorten the SQL:
q0 =
On Jan 26, 2009, at 7:31 PM, Jon Nelson wrote:
I assumed it was a bug due to the presence of a python-style string
substitution.
...
another option is
sess.query(Account).filter(Account.id.in_(your subquery)).
When I do it that way, I get crazy SQL and an error. Using
On Mon, Jan 26, 2009 at 7:05 PM, Michael Bayer mike...@zzzcomputing.com wrote:
On Jan 26, 2009, at 7:31 PM, Jon Nelson wrote:
I assumed it was a bug due to the presence of a python-style string
substitution.
...
another option is
sess.query(Account).filter(Account.id.in_(your