From ed4533648d2bafc14661ccd862df4f5875641d31 Mon Sep 17 00:00:00 2001 From: Maxim Mishchenko Date: Wed, 11 Jun 2025 15:55:18 +0200 Subject: [PATCH 1/2] SNOW-2129602 Fix GCS staging by ensuring the endpoint has a scheme --- DESCRIPTION.md | 1 + src/snowflake/connector/gcs_storage_client.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/DESCRIPTION.md b/DESCRIPTION.md index d1a8592bec..78b6b5a170 100644 --- a/DESCRIPTION.md +++ b/DESCRIPTION.md @@ -11,6 +11,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne - Bumped numpy dependency from <2.1.0 to <=2.2.4 - Added Windows support for Python 3.13. - Add `bulk_upload_chunks` parameter to `write_pandas` function. Setting this parameter to True changes the behaviour of write_pandas function to first write all the data chunks to the local disk and then perform the wildcard upload of the chunks folder to the stage. In default behaviour the chunks are being saved, uploaded and deleted one by one. + - Fix GCS staging by ensuring the endpoint has a scheme. - v3.15.1(May 20, 2025) diff --git a/src/snowflake/connector/gcs_storage_client.py b/src/snowflake/connector/gcs_storage_client.py index 2f07aacbe3..6fc7cdb950 100644 --- a/src/snowflake/connector/gcs_storage_client.py +++ b/src/snowflake/connector/gcs_storage_client.py @@ -438,6 +438,8 @@ def get_location( if endpoint: if endpoint.endswith("/"): endpoint = endpoint[:-1] + if not endpoint.startswith("https://"): + endpoint = "https://" + endpoint return GcsLocation(bucket_name=container_name, path=path, endpoint=endpoint) elif use_virtual_url: return GcsLocation( From 4fc2bab0cadf6059eb5f1711ab0978e631ef7e53 Mon Sep 17 00:00:00 2001 From: Maxim Mishchenko Date: Tue, 12 Aug 2025 17:11:34 +0200 Subject: [PATCH 2/2] SNOW-2129602 add a unit test --- test/unit/test_gcs_client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/unit/test_gcs_client.py b/test/unit/test_gcs_client.py index eeed8690f7..0effed2a9f 100644 --- a/test/unit/test_gcs_client.py +++ b/test/unit/test_gcs_client.py @@ -432,6 +432,14 @@ def test_get_file_header_none_with_presigned_url(tmp_path): True, "https://overriddenurl.com/filename", ), + ( + "US-CENTRAL1", + "https://overriddenurl.com", + False, + "overriddenurl.com", + True, + "https://overriddenurl.com/filename", + ), ], ) def test_url(