offset limit doesn't work with sybase dialect

Issue #2278 resolved
Former user created an issue

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)

  1. Mike Bayer repo owner
    • assigned issue to
    • changed component to sybase
    • changed milestone to 0.7.xx

    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.

  2. Mike Bayer repo owner
    • 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>>

  3. Log in to comment