Skip to content

Commit 6d08841

Browse files
lpoulainhashhar
authored andcommitted
Add support for parametric datetimes
This change starts sending the PARAMETRIC_DATETIME client capability in the X-Trino-Client-Capabilities request headers so that Trino sends back temporal types in their original precision instead of always sending back results with millisecond precision.
1 parent 8affa61 commit 6d08841

File tree

5 files changed

+224
-191
lines changed

5 files changed

+224
-191
lines changed

tests/integration/test_dbapi_integration.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def test_datetime_query_param(trino_connection):
287287
rows = cur.fetchall()
288288

289289
assert rows[0][0] == params
290-
assert cur.description[0][1] == "timestamp"
290+
assert cur.description[0][1] == "timestamp(6)"
291291

292292

293293
def test_datetime_with_utc_time_zone_query_param(trino_connection):
@@ -299,7 +299,7 @@ def test_datetime_with_utc_time_zone_query_param(trino_connection):
299299
rows = cur.fetchall()
300300

301301
assert rows[0][0] == params
302-
assert cur.description[0][1] == "timestamp with time zone"
302+
assert cur.description[0][1] == "timestamp(6) with time zone"
303303

304304

305305
def test_datetime_with_numeric_offset_time_zone_query_param(trino_connection):
@@ -313,7 +313,7 @@ def test_datetime_with_numeric_offset_time_zone_query_param(trino_connection):
313313
rows = cur.fetchall()
314314

315315
assert rows[0][0] == params
316-
assert cur.description[0][1] == "timestamp with time zone"
316+
assert cur.description[0][1] == "timestamp(6) with time zone"
317317

318318

319319
def test_datetime_with_named_time_zone_query_param(trino_connection):
@@ -325,7 +325,7 @@ def test_datetime_with_named_time_zone_query_param(trino_connection):
325325
rows = cur.fetchall()
326326

327327
assert rows[0][0] == params
328-
assert cur.description[0][1] == "timestamp with time zone"
328+
assert cur.description[0][1] == "timestamp(6) with time zone"
329329

330330

331331
def test_datetime_with_trailing_zeros(trino_connection):
@@ -463,6 +463,7 @@ def test_time_query_param(trino_connection):
463463
rows = cur.fetchall()
464464

465465
assert rows[0][0] == params
466+
assert cur.description[0][1] == "time(6)"
466467

467468

468469
def test_time_with_named_time_zone_query_param(trino_connection):
@@ -492,6 +493,7 @@ def test_time(trino_connection):
492493
rows = cur.fetchall()
493494

494495
assert rows[0][0] == time(1, 2, 3, 456000)
496+
assert cur.description[0][1] == "time(3)"
495497

496498

497499
def test_null_time(trino_connection):
@@ -512,6 +514,7 @@ def test_time_with_time_zone_negative_offset(trino_connection):
512514
tz = timezone(-timedelta(hours=8, minutes=0))
513515

514516
assert rows[0][0] == time(1, 2, 3, 456000, tzinfo=tz)
517+
assert cur.description[0][1] == "time(3) with time zone"
515518

516519

517520
def test_time_with_time_zone_positive_offset(trino_connection):
@@ -523,6 +526,7 @@ def test_time_with_time_zone_positive_offset(trino_connection):
523526
tz = timezone(timedelta(hours=8, minutes=0))
524527

525528
assert rows[0][0] == time(1, 2, 3, 456000, tzinfo=tz)
529+
assert cur.description[0][1] == "time(3) with time zone"
526530

527531

528532
def test_null_date_with_time_zone(trino_connection):

0 commit comments

Comments
 (0)