offset limit doesn't work with sybase dialect
Issue #2278
resolved
Going thru the ORM tutorial, the following code:
for u in session.query(User).order_by(User.id)1:3: ... print u
gives: sqlalchemy.exc.DatabaseError: (DatabaseError) Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '2'. 'SELECT TOP 2 START AT 2 ....ommitted...
Probably to do with using SQL Anywhere syntax which is not supported in ASE
Comments (3)
-
repo owner -
repo owner - changed milestone to 1.x.xx
-
repo owner - changed status to resolved
- The unsupported Sybase dialect now raises
NotImplementedError
when attempting to compile a query that includes "offset"; Sybase has no straightforward "offset" feature. fixes#2278
→ <<cset 61016f17d1a5>>
- Log in to comment
The dialect was ported from SQL Anywhere to ASE. "TOP N" is the correct syntax. The "START AT" part probably isn't - to my knowledge Sybase ASE supports no "START AT" feature. Here's a document which suggests using "set cursor rowcount" - not something SQLAlchemy is really prepared to do here automatically:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36272.1550/html/commands/X35229.htm
so I'd propose just having OFFSET raise a NotImplementedError. It's not really an option with ASE.