mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-28 03:26:01 -04:00
20cdc64588
become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
29 lines
740 B
Python
29 lines
740 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 mapping.items():
|
|
self.assert_compile(
|
|
select([extract(field, t.c.col1)]),
|
|
'SELECT DATEPART("%s", t.col1) AS anon_1 FROM t' % subst)
|
|
|
|
|
|
|