Files
sqlalchemy/test/dialect/test_sybase.py
T
Mike Bayer 4b614b9b35 - the raw 2to3 run
- went through examples/ and cleaned out excess list() calls
2013-04-27 19:53:57 -04:00

29 lines
746 B
Python

from sqlalchemy import *
from sqlalchemy import sql
from sqlalchemy.databases import sybase
from sqlalchemy.testing import *
class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
__dialect__ = sybase.dialect()
def test_extract(self):
t = sql.table('t', sql.column('col1'))
mapping = {
'day': 'day',
'doy': 'dayofyear',
'dow': 'weekday',
'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)