From 2405abe6cc42e864e12d21c68f9dfb1b6afa80ac Mon Sep 17 00:00:00 2001 From: Shobhit Singh Date: Mon, 13 Nov 2023 22:19:14 +0000 Subject: [PATCH 1/3] chore: deprecate `use_regional_endpoints` --- bigframes/_config/bigquery_options.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bigframes/_config/bigquery_options.py b/bigframes/_config/bigquery_options.py index d0cce9492b..f5c6439141 100644 --- a/bigframes/_config/bigquery_options.py +++ b/bigframes/_config/bigquery_options.py @@ -17,6 +17,7 @@ from __future__ import annotations from typing import Optional +import warnings import google.api_core.exceptions import google.auth.credentials @@ -123,6 +124,10 @@ def bq_connection(self, value: Optional[str]): def use_regional_endpoints(self) -> bool: """Flag to connect to regional API endpoints. + .. deprecated:: 0.13.0 + BigQuery regional endpoints is locked to allowlisted projects. + Enable it only if your project has regional endpoints access. + Requires ``location`` to also be set. For example, set ``location='asia-northeast1'`` and ``use_regional_endpoints=True`` to connect to asia-northeast1-bigquery.googleapis.com. @@ -135,4 +140,11 @@ def use_regional_endpoints(self, value: bool): raise ValueError( SESSION_STARTED_MESSAGE.format(attribute="use_regional_endpoints") ) + + if value: + warnings.warn( + "BigQuery regional endpoints is locked to allowlisted projects. " + "Enable it only if your project has regional endpoints access." + ) + self._use_regional_endpoints = value From 39a73bc58465ad2ee4c71cb978a444f1dcc99a18 Mon Sep 17 00:00:00 2001 From: Shobhit Singh Date: Mon, 13 Nov 2023 23:46:57 +0000 Subject: [PATCH 2/3] don't enable `use_regional_endpoints` in system tests --- tests/system/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/system/conftest.py b/tests/system/conftest.py index f9f69c6c8e..0ad4280497 100644 --- a/tests/system/conftest.py +++ b/tests/system/conftest.py @@ -120,7 +120,6 @@ def session() -> bigframes.Session: def session_tokyo(tokyo_location: str) -> bigframes.Session: context = bigframes.BigQueryOptions( location=tokyo_location, - use_regional_endpoints=True, ) return bigframes.Session(context=context) From 8917d44d7e7decc2a03859d6c3c0563a4bb520c6 Mon Sep 17 00:00:00 2001 From: Shobhit Singh Date: Fri, 8 Dec 2023 07:21:35 +0000 Subject: [PATCH 3/3] reword the regional endpoints deprecation message --- bigframes/_config/bigquery_options.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bigframes/_config/bigquery_options.py b/bigframes/_config/bigquery_options.py index f5c6439141..2875a11de3 100644 --- a/bigframes/_config/bigquery_options.py +++ b/bigframes/_config/bigquery_options.py @@ -125,7 +125,8 @@ def use_regional_endpoints(self) -> bool: """Flag to connect to regional API endpoints. .. deprecated:: 0.13.0 - BigQuery regional endpoints is locked to allowlisted projects. + BigQuery regional endpoints is a feature in preview and + available only to selected projects. Enable it only if your project has regional endpoints access. Requires ``location`` to also be set. For example, set @@ -143,7 +144,8 @@ def use_regional_endpoints(self, value: bool): if value: warnings.warn( - "BigQuery regional endpoints is locked to allowlisted projects. " + "BigQuery regional endpoints is a feature in preview and " + "available only to selected projects. " "Enable it only if your project has regional endpoints access." )