s += "TOP %s " % (limit,)
offset = select._offset
if offset:
- if not limit:
- # FIXME: sybase doesn't allow an offset without a limit
- # so use a huge value for TOP here
- s += "TOP 1000000 "
- s += "START AT %s " % (offset + 1,)
+ raise NotImplementedError("Sybase ASE does not support OFFSET")
return s
def get_from_hint_text(self, table, text):
-from sqlalchemy import *
+from sqlalchemy import extract, select
from sqlalchemy import sql
from sqlalchemy.databases import sybase
-from sqlalchemy.testing import *
+from sqlalchemy.testing import assert_raises_message, \
+ fixtures, AssertsCompiledSQL
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
'milliseconds': 'millisecond',
'millisecond': 'millisecond',
'year': 'year',
- }
+ }
for field, subst in list(mapping.items()):
self.assert_compile(
select([extract(field, t.c.col1)]),
'SELECT DATEPART("%s", t.col1) AS anon_1 FROM t' % subst)
+ def test_offset_not_supported(self):
+ stmt = select([1]).offset(10)
+ assert_raises_message(
+ NotImplementedError,
+ "Sybase ASE does not support OFFSET",
+ stmt.compile, dialect=self.__dialect__
+ )