Skip to content

Commit 985ec5e

Browse files
SNOW-1789751: Pass GCS regional and virtual params (#2241)
1 parent 813bbd8 commit 985ec5e

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

DESCRIPTION.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1515
- Added handling of PAT provided in `password` field.
1616
- Improved error message for client-side query cancellations due to timeouts.
1717
- Added support of GCS regional endpoints.
18-
- Added `gcs_use_virtual_endpoints` connection property that forces the usage of the virtual GCS usage. See more: https://cloud.google.com/storage/docs/request-endpoints#xml-api
18+
- Added `gcs_use_virtual_endpoints` connection property that forces the usage of the virtual GCS usage. Thanks to this it should be possible to set up private DNS entry for the GCS endpoint. See more: https://cloud.google.com/storage/docs/request-endpoints#xml-api
1919
- Fixed a bug that caused driver to fail silently on `TO_DATE` arrow to python conversion when invalid date was followed by the correct one.
2020
- Added `check_arrow_conversion_error_on_every_column` connection property that can be set to `False` to restore previous behaviour in which driver will ignore errors until it occurs in the last column. This flag's purpose is to unblock workflows that may be impacted by the bugfix and will be removed in later releases.
2121

src/snowflake/connector/file_transfer_agent.py

+1
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,7 @@ def _create_file_transfer_client(
701701
self._cursor._connection,
702702
self._command,
703703
unsafe_file_write=self._unsafe_file_write,
704+
use_virtual_endpoints=self._gcs_use_virtual_endpoints,
704705
)
705706
raise Exception(f"{self._stage_location_type} is an unknown stage type")
706707

src/snowflake/connector/gcs_storage_client.py

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def __init__(
5252
cnx: SnowflakeConnection,
5353
command: str,
5454
unsafe_file_write: bool = False,
55+
use_virtual_endpoints: bool = False,
5556
) -> None:
5657
"""Creates a client object with given stage credentials.
5758
@@ -85,6 +86,7 @@ def __init__(
8586
self.endpoint: str | None = (
8687
None if "endPoint" not in stage_info else stage_info["endPoint"]
8788
)
89+
self.use_virtual_endpoints: bool = use_virtual_endpoints
8890

8991
if self.security_token:
9092
logger.debug(f"len(GCS_ACCESS_TOKEN): {len(self.security_token)}")
@@ -166,6 +168,8 @@ def generate_url_and_rest_args() -> (
166168
if "region" not in self.stage_info
167169
else self.stage_info["region"]
168170
),
171+
self.endpoint,
172+
self.use_virtual_endpoints,
169173
)
170174
access_token = self.security_token
171175
else:
@@ -204,6 +208,7 @@ def generate_url_and_rest_args() -> (
204208
else self.stage_info["region"]
205209
),
206210
self.endpoint,
211+
self.use_virtual_endpoints,
207212
)
208213
access_token = self.security_token
209214
gcs_headers["Authorization"] = f"Bearer {access_token}"
@@ -368,6 +373,8 @@ def generate_url_and_authenticated_headers():
368373
if "region" not in self.stage_info
369374
else self.stage_info["region"]
370375
),
376+
self.endpoint,
377+
self.use_virtual_endpoints,
371378
)
372379
gcs_headers = {"Authorization": f"Bearer {self.security_token}"}
373380
rest_args = {"headers": gcs_headers}

0 commit comments

Comments
 (0)