2222 from snowflake .connector import SnowflakeConnection , SnowflakeCursor
2323
2424
25+ def _normalize_windows_local_path (path ):
26+ return path .replace ("\\ " , "\\ \\ " )
27+
28+
2529def _validate_upload_content (
2630 expected_content , cursor , stage_name , local_dir , base_file_name , is_compressed
2731):
@@ -30,7 +34,9 @@ def _validate_upload_content(
3034 local_path = os .path .join (local_dir , base_file_name )
3135
3236 cursor .execute (
33- f"GET ? 'file://{ local_dir } '" , params = [stage_path ], _force_qmark_paramstyle = True
37+ f"GET ? 'file://{ _normalize_windows_local_path (local_dir )} '" ,
38+ params = [stage_path ],
39+ _force_qmark_paramstyle = True ,
3440 )
3541 if is_compressed :
3642 stage_path += gz_suffix
@@ -90,7 +96,7 @@ def test_upload(
9096):
9197 def upload_task (cursor , stage_name , temp_dir , base_file_name ):
9298 cursor ._upload (
93- local_file_name = f"file://{ os .path .join (temp_dir , base_file_name )} " ,
99+ local_file_name = f"file://{ _normalize_windows_local_path ( os .path .join (temp_dir , base_file_name ) )} " ,
94100 stage_location = f"@{ stage_name } " ,
95101 options = {"auto_compress" : is_compressed },
96102 )
0 commit comments