diff options
author | Jason Kirtland <jek@discorporate.us> | 2009-03-30 20:41:48 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2009-03-30 20:41:48 +0000 |
commit | aca84bebb091a51ceeb911249c366e17b954826a (patch) | |
tree | 87a0424805905c9fdae0ab6930144c91b9a78ff6 /test/dialect/mysql.py | |
parent | 1ad157a0a1823706ffb43ee7d235c38ae16f46ff (diff) | |
download | sqlalchemy-aca84bebb091a51ceeb911249c366e17b954826a.tar.gz |
extract() is now dialect-sensitive and supports SQLite and others.
Diffstat (limited to 'test/dialect/mysql.py')
-rw-r--r-- | test/dialect/mysql.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/dialect/mysql.py b/test/dialect/mysql.py index a233c25f5..fa8a85ec4 100644 --- a/test/dialect/mysql.py +++ b/test/dialect/mysql.py @@ -982,6 +982,19 @@ class SQLTest(TestBase, AssertsCompiledSQL): for type_, expected in specs: self.assert_compile(cast(t.c.col, type_), expected) + def test_extract(self): + t = sql.table('t', sql.column('col1')) + + for field in 'year', 'month', 'day': + self.assert_compile( + select([extract(field, t.c.col1)]), + "SELECT EXTRACT(%s FROM t.col1) AS anon_1 FROM t" % field) + + # millsecondS to millisecond + self.assert_compile( + select([extract('milliseconds', t.c.col1)]), + "SELECT EXTRACT(millisecond FROM t.col1) AS anon_1 FROM t") + class RawReflectionTest(TestBase): def setUp(self): |