3232from snowflake .connector .result_set import ResultSet
3333
3434from . import compat
35+ from ._sql_util import get_file_transfer_type
3536from .bind_upload_agent import BindUploadAgent , BindUploadError
3637from .constants import (
3738 FIELD_NAME_TO_ID ,
@@ -183,8 +184,6 @@ class SnowflakeCursor:
183184 Calling a function is expensive in Python and most of these getters are unnecessary.
184185 """
185186
186- PUT_SQL_RE = re .compile (r"^(?:/\*.*\*/\s*)*put\s+" , flags = re .IGNORECASE )
187- GET_SQL_RE = re .compile (r"^(?:/\*.*\*/\s*)*get\s+" , flags = re .IGNORECASE )
188187 INSERT_SQL_RE = re .compile (r"^insert\s+into" , flags = re .IGNORECASE )
189188 COMMENT_SQL_RE = re .compile (r"/\*.*\*/" )
190189 INSERT_SQL_VALUES_RE = re .compile (
@@ -202,11 +201,7 @@ def get_file_transfer_type(sql: str) -> FileTransferType | None:
202201 None is returned if the SQL isn't a file transfer so that this function can be
203202 used in an if-statement.
204203 """
205- if SnowflakeCursor .PUT_SQL_RE .match (sql ):
206- return FileTransferType .PUT
207- elif SnowflakeCursor .GET_SQL_RE .match (sql ):
208- return FileTransferType .GET
209- return None
204+ return get_file_transfer_type (sql )
210205
211206 def __init__ (
212207 self ,
@@ -464,9 +459,7 @@ def _execute_helper(
464459 self ._is_file_transfer = _is_put_get
465460 else :
466461 # or detect it.
467- self ._is_file_transfer = self .PUT_SQL_RE .match (
468- query
469- ) or self .GET_SQL_RE .match (query )
462+ self ._is_file_transfer = get_file_transfer_type (query ) is not None
470463 logger .debug ("is_file_transfer: %s" , self ._is_file_transfer is not None )
471464
472465 real_timeout = (
0 commit comments