6
6
import numpy
7
7
import pytest
8
8
9
+ from snowflake .connector import constants
10
+
9
11
pytestmark = pytest .mark .skipolddriver # old test driver tests won't run this module
10
12
11
13
@@ -30,14 +32,17 @@ def test_select_year_month_interval(conn_cnx, use_numpy, result_format):
30
32
cursor .execute ("alter session set feature_interval_types=enabled" )
31
33
cursor .execute (f"create or replace table { table } (c1 interval year to month)" )
32
34
cursor .execute (f"insert into { table } values { values } " )
33
- result = conn .cursor ().execute (f"select * from { table } " ).fetchall ()
35
+ result = cursor .execute (f"select * from { table } " ).fetchall ()
36
+ # Validate column metadata.
37
+ type_code = cursor ._description [0 ].type_code
38
+ assert (
39
+ constants .FIELD_ID_TO_NAME [type_code ] == "INTERVAL_YEAR_MONTH"
40
+ ), f"invalid column type: { type_code } "
41
+ # Validate column values.
34
42
result = [r [0 ] for r in result ]
35
43
assert result == expected
36
44
37
45
38
- @pytest .mark .skip (
39
- reason = "SNOW-1878635: Add support for day-time interval in ArrowStreamWriter"
40
- )
41
46
@pytest .mark .parametrize ("use_numpy" , [True , False ])
42
47
@pytest .mark .parametrize ("result_format" , ["json" , "arrow" ])
43
48
def test_select_day_time_interval (conn_cnx , use_numpy , result_format ):
@@ -71,6 +76,12 @@ def test_select_day_time_interval(conn_cnx, use_numpy, result_format):
71
76
f"create or replace table { table } (c1 interval day(5) to second)"
72
77
)
73
78
cursor .execute (f"insert into { table } values { values } " )
74
- result = conn .cursor ().execute (f"select * from { table } " ).fetchall ()
79
+ result = cursor .execute (f"select * from { table } " ).fetchall ()
80
+ # Validate column metadata.
81
+ type_code = cursor ._description [0 ].type_code
82
+ assert (
83
+ constants .FIELD_ID_TO_NAME [type_code ] == "INTERVAL_DAY_TIME"
84
+ ), f"invalid column type: { type_code } "
85
+ # Validate column values.
75
86
result = [r [0 ] for r in result ]
76
87
assert result == expected
0 commit comments