[sqlalchemy] Re: select.count() vs MSSQL

2008-01-30 Thread Rick Morrison
...or is select.alias().count().scalar()the standard way to do this? On Jan 30, 2008 7:29 PM, Rick Morrison [EMAIL PROTECTED] wrote: Just noticed that select.count() doesn't work on MSSQL. The implementation wraps the select() in an outer query; MSSQL requires an alias for the inner

[sqlalchemy] Re: select.count() vs MSSQL

2008-01-30 Thread Michael Bayer
youd have to override visit_select() and pick up on compiler.is_subquery(). you could then do some tricks similar to what oracle.py does in visit_select() to create a wrapping layer. also i noticed the usage of a kwarg 'mssql_aliased' which seems to be referenced nowhere. On Jan 30,

[sqlalchemy] Re: select.count() vs MSSQL

2008-01-30 Thread Rick Morrison
Thanks Mike, I've got my local visit_select() a bit munged-up right now with an implementation of OFFSET, so I'm going to wait a bit on this. In the meantime, a follow-up: Not every MSSQL subquery needs to be aliased, only when the subquery is used as a derived table, as the SA implementation of

[sqlalchemy] Re: select.count() vs MSSQL

2008-01-30 Thread Michael Bayer
On Jan 30, 2008, at 10:52 PM, Rick Morrison wrote: Thanks Mike, I've got my local visit_select() a bit munged-up right now with an implementation of OFFSET, so I'm going to wait a bit on this. In the meantime, a follow-up: Not every MSSQL subquery needs to be aliased, only when the

[sqlalchemy] Re: select.count() vs MSSQL

2008-01-30 Thread Michael Bayer
On Jan 30, 2008, at 11:08 PM, Michael Bayer wrote: you can in fact alias whatever select you want, i think. select.count() doesn't produce any kind of special construct that could be detected in the compiler. there is the notion that subqueries which are used as scalar subqueries, i.e.