File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1010
1111- v3.12.0(TBD)
1212 - Optimized ` to_pandas() ` performance by fully parallel downloading logic.
13-
13+ - Fixed a bug that specifying client_session_keep_alive_heartbeat_frequency in snowflake-sqlalchemy could crash the connector
1414
1515- v3.11.0(June 17,2024)
1616 - Added support for ` token_file_path ` connection parameter to read an OAuth token from a file when connecting to Snowflake.
Original file line number Diff line number Diff line change @@ -1673,6 +1673,12 @@ def _validate_client_session_keep_alive_heartbeat_frequency(self) -> int:
16731673 """Validate and return heartbeat frequency in seconds."""
16741674 real_max = int (self .rest .master_validity_in_seconds / 4 )
16751675 real_min = int (real_max / 4 )
1676+
1677+ # ensure the type is integer
1678+ self ._client_session_keep_alive_heartbeat_frequency = int (
1679+ self .client_session_keep_alive_heartbeat_frequency
1680+ )
1681+
16761682 if self .client_session_keep_alive_heartbeat_frequency is None :
16771683 # This is an unlikely scenario but covering it just in case.
16781684 self ._client_session_keep_alive_heartbeat_frequency = real_min
@@ -1681,10 +1687,6 @@ def _validate_client_session_keep_alive_heartbeat_frequency(self) -> int:
16811687 elif self .client_session_keep_alive_heartbeat_frequency < real_min :
16821688 self ._client_session_keep_alive_heartbeat_frequency = real_min
16831689
1684- # ensure the type is integer
1685- self ._client_session_keep_alive_heartbeat_frequency = int (
1686- self .client_session_keep_alive_heartbeat_frequency
1687- )
16881690 return self .client_session_keep_alive_heartbeat_frequency
16891691
16901692 def _validate_client_prefetch_threads (self ) -> int :
Original file line number Diff line number Diff line change @@ -233,10 +233,12 @@ def test_keep_alive_heartbeat_frequency(db_parameters):
233233 cnx .close ()
234234
235235
236+ @pytest .mark .skipolddriver
236237def test_keep_alive_heartbeat_frequency_min (db_parameters ):
237238 """Tests heartbeat setting with custom frequency.
238239
239240 Creates a connection with client_session_keep_alive_heartbeat_frequency parameter and set the minimum frequency.
241+ Also if a value comes as string, should be properly converted to int and not fail assertion.
240242 """
241243 config = {
242244 "user" : db_parameters ["user" ],
@@ -249,7 +251,7 @@ def test_keep_alive_heartbeat_frequency_min(db_parameters):
249251 "protocol" : db_parameters ["protocol" ],
250252 "timezone" : "UTC" ,
251253 "client_session_keep_alive" : True ,
252- "client_session_keep_alive_heartbeat_frequency" : 10 ,
254+ "client_session_keep_alive_heartbeat_frequency" : "10" ,
253255 }
254256 cnx = snowflake .connector .connect (** config )
255257 try :
You can’t perform that action at this time.
0 commit comments