MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_extract

Method test_extract

test/dialect/mysql/test_compiler.py:1114–1127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1112 )
1113
1114 def test_extract(self):
1115 t = sql.table("t", sql.column("col1"))
1116
1117 for field in "year", "month", "day":
1118 self.assert_compile(
1119 select(extract(field, t.c.col1)),
1120 "SELECT EXTRACT(%s FROM t.col1) AS anon_1 FROM t" % field,
1121 )
1122
1123 # milliseconds to millisecond
1124 self.assert_compile(
1125 select(extract("milliseconds", t.c.col1)),
1126 "SELECT EXTRACT(millisecond FROM t.col1) AS anon_1 FROM t",
1127 )
1128
1129 def test_too_long_index(self):
1130 exp = "ix_zyrenian_zyme_zyzzogeton_zyzzogeton_zyrenian_zyme_zyz_5cd2"

Callers

nothing calls this directly

Calls 5

selectFunction · 0.90
extractFunction · 0.90
assert_compileMethod · 0.80
tableMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected