From aca84bebb091a51ceeb911249c366e17b954826a Mon Sep 17 00:00:00 2001 From: Jason Kirtland Date: Mon, 30 Mar 2009 20:41:48 +0000 Subject: extract() is now dialect-sensitive and supports SQLite and others. --- test/dialect/mysql.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/dialect/mysql.py') 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): -- cgit v1.2.1