Skip to content

Commit f1bbba2

Browse files
authored
docs: add bigframes default connection warning (#2471)
fixes b/471256706
1 parent 61a9484 commit f1bbba2

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎bigframes/bigquery/_operations/ai.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ def _convert_series(
10181018

10191019
def_resolve_connection_id(series: series.Series, connection_id: str|None):
10201020
returnclients.get_canonical_bq_connection_id(
1021-
connection_idorseries._session._bq_connection,
1021+
connection_idorseries._session.bq_connection,
10221022
series._session._project,
10231023
series._session._location,
10241024
)

‎bigframes/functions/_function_session.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def _resolve_bigquery_connection_id(
162162
) ->str:
163163
"""Resolves BigQuery connection id."""
164164
ifnotbigquery_connection:
165-
bigquery_connection=session._bq_connection# type: ignore
165+
bigquery_connection=session.bq_connection# type: ignore
166166

167167
bigquery_connection=clients.get_canonical_bq_connection_id(
168168
bigquery_connection,

‎bigframes/operations/blob.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def _resolve_connection(self, connection: Optional[str] = None) -> str:
311311
Raises:
312312
ValueError: If the connection cannot be resolved to a valid string.
313313
"""
314-
connection=connectionorself._data._block.session._bq_connection
314+
connection=connectionorself._data._block.session.bq_connection
315315
returnclients.get_canonical_bq_connection_id(
316316
connection,
317317
default_project=self._data._block.session._project,

‎bigframes/session/__init__.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,16 @@ def _allows_ambiguity(self) -> bool:
374374
def_anonymous_dataset(self):
375375
returnself._anon_dataset_manager.dataset
376376

377+
@property
378+
defbq_connection(self) ->str:
379+
msg=bfe.format_message(
380+
f"""You are using the BigFrames session default connection: {self._bq_connection},
381+
which can be different from the BigQuery project default connection.
382+
This default connection may change in the future."""
383+
)
384+
warnings.warn(msg, category=FutureWarning)
385+
returnself._bq_connection
386+
377387
def__hash__(self):
378388
# Stable hash needed to use in expression tree
379389
returnhash(str(self._session_id))
@@ -2253,7 +2263,7 @@ def _create_bq_connection(
22532263
) ->str:
22542264
"""Create the connection with the session settings and try to attach iam role to the connection SA.
22552265
If any of project, location or connection isn't specified, use the session defaults. Returns fully-qualified connection name."""
2256-
connection=self._bq_connectionifnotconnectionelseconnection
2266+
connection=self.bq_connectionifnotconnectionelseconnection
22572267
connection=bigframes.clients.get_canonical_bq_connection_id(
22582268
connection_id=connection,
22592269
default_project=self._project,

0 commit comments

Comments
 (0)