10 messages in com.googlegroups.sqlalchemy[sqlalchemy] MSSQL and LIMIT/OFFSET
FromSent OnAttachments
Paul Johnston26 Nov 2007 11:25 
Michael Bayer26 Nov 2007 12:17.patch
Esceo09 Jan 2008 23:46 
Esceo10 Jan 2008 00:40 
Paul Johnston10 Jan 2008 01:02 
Esceo10 Jan 2008 01:33 
Esceo10 Jan 2008 02:41 
lei you10 Jan 2008 02:43.diff
Esceo10 Jan 2008 02:46 
Esceo10 Jan 2008 19:36 
Subject:[sqlalchemy] MSSQL and LIMIT/OFFSET
From:Paul Johnston (pa@pajhome.org.uk)
Date:11/26/2007 11:25:18 AM
List:com.googlegroups.sqlalchemy

Hi,

Can someone (Mike?) give me a hand with this, I've hit the limits of my understanding of the query compiler.

The patch I've done on #638 (mostly copied from Oracle) creates a subquery with row_number if there is an OFFSET. It aliases the query, because MSSQL is funny about that, and it also attempts to move ORDER BY from the inner to outer query (again, MSSQL is funny). Only problem is that it doesn't quite pick up the correct labelled name. Uncomment this line in the patch to see the problem: #limitselect._order_by_clause = select._order_by_clause

Any ideas would be a help (and a query compiler 101 document would be fab!)

Paul