offset limit doesn't work with sybase dialect

Issue #2278 resolved
Anonymous created an issue

Going thru the ORM tutorial, the following code:

for u in session.query(User).order_by( ... 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. Michael Bayer repo owner

    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:

    so I'd propose just having OFFSET raise a NotImplementedError. It's not really an option with ASE.

  2. Log in to comment