| 55 | __dialect__ = sqlite.dialect() |
| 56 | |
| 57 | def test_extract(self): |
| 58 | t = sql.table("t", sql.column("col1")) |
| 59 | mapping = { |
| 60 | "month": "%m", |
| 61 | "day": "%d", |
| 62 | "year": "%Y", |
| 63 | "second": "%S", |
| 64 | "hour": "%H", |
| 65 | "doy": "%j", |
| 66 | "minute": "%M", |
| 67 | "epoch": "%s", |
| 68 | "dow": "%w", |
| 69 | "week": "%W", |
| 70 | } |
| 71 | for field, subst in mapping.items(): |
| 72 | self.assert_compile( |
| 73 | select(extract(field, t.c.col1)), |
| 74 | "SELECT CAST(STRFTIME('%s', t.col1) AS " |
| 75 | "INTEGER) AS anon_1 FROM t" % subst, |
| 76 | ) |
| 77 | |
| 78 | def test_plain_stringify_returning(self): |
| 79 | t = Table( |