@@ -106,6 +106,7 @@ class FooBar(Base):
106106 datetime_notz = sa .Column (DateTime (timezone = False ))
107107 datetime_tz = sa .Column (DateTime (timezone = True ))
108108 time = sa .Column (sa .Time )
109+ time_upper = sa .Column (sa .TIME ())
109110
110111
111112@pytest .fixture
@@ -234,10 +235,11 @@ def test_datetime_date(session):
234235@pytest .mark .skipif (SA_VERSION < SA_1_4 , reason = "Test case not supported on SQLAlchemy 1.3" )
235236def test_time (session ):
236237 """
237- An integration test for `sa.Time`.
238+ An integration test for `sa.Time` and the SQL-standard `sa.TIME` .
238239
239240 CrateDB has no native `TIME` type, so the dialect stores it as a `STRING`
240- in ISO 8601 format and parses it back into a `dt.time` object on read.
241+ in ISO 8601 format and parses it back into a `dt.time` object on read. Both
242+ spellings resolve to the same colspec, so both must round-trip.
241243
242244 Validates the fix for https://github.com/crate/sqlalchemy-cratedb/issues/206.
243245 """
@@ -246,14 +248,21 @@ def test_time(session):
246248 foo_item = FooBar (
247249 name = "foo" ,
248250 time = dt .time (19 , 0 , 30 , 123456 ),
251+ time_upper = dt .time (19 , 0 , 30 , 123456 ),
249252 )
250253 session .add (foo_item )
251254 session .commit ()
252255 session .execute (sa .text ("REFRESH TABLE foobar" ))
253256
254257 # query
255- result = session .execute (sa .select (FooBar .name , FooBar .time )).mappings ().first ()
258+ result = (
259+ session .execute (sa .select (FooBar .name , FooBar .time , FooBar .time_upper ))
260+ .mappings ()
261+ .first ()
262+ )
256263
257264 # compare
258265 assert result ["time" ] == dt .time (19 , 0 , 30 , 123456 )
259266 assert isinstance (result ["time" ], dt .time )
267+ assert result ["time_upper" ] == dt .time (19 , 0 , 30 , 123456 )
268+ assert isinstance (result ["time_upper" ], dt .time )
0 commit comments