66import numpy
77import pytest
88
9+ from snowflake .connector import constants
10+
911pytestmark = pytest .mark .skipolddriver # old test driver tests won't run this module
1012
1113
@@ -30,14 +32,17 @@ def test_select_year_month_interval(conn_cnx, use_numpy, result_format):
3032 cursor .execute ("alter session set feature_interval_types=enabled" )
3133 cursor .execute (f"create or replace table { table } (c1 interval year to month)" )
3234 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.
3442 result = [r [0 ] for r in result ]
3543 assert result == expected
3644
3745
38- @pytest .mark .skip (
39- reason = "SNOW-1878635: Add support for day-time interval in ArrowStreamWriter"
40- )
4146@pytest .mark .parametrize ("use_numpy" , [True , False ])
4247@pytest .mark .parametrize ("result_format" , ["json" , "arrow" ])
4348def 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):
7176 f"create or replace table { table } (c1 interval day(5) to second)"
7277 )
7378 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.
7586 result = [r [0 ] for r in result ]
7687 assert result == expected
0 commit comments