Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bigframes/bigquery/_operations/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ def _convert_series(

def _resolve_connection_id(series: series.Series, connection_id: str | None):
return clients.get_canonical_bq_connection_id(
connection_id or series._session._bq_connection,
connection_id or series._session.bq_connection,
series._session._project,
series._session._location,
)
Expand Down
2 changes: 1 addition & 1 deletion bigframes/functions/_function_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def _resolve_bigquery_connection_id(
) -> str:
"""Resolves BigQuery connection id."""
if not bigquery_connection:
bigquery_connection = session._bq_connection # type: ignore
bigquery_connection = session.bq_connection # type: ignore

bigquery_connection = clients.get_canonical_bq_connection_id(
bigquery_connection,
Expand Down
2 changes: 1 addition & 1 deletion bigframes/operations/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def _resolve_connection(self, connection: Optional[str] = None) -> str:
Raises:
ValueError: If the connection cannot be resolved to a valid string.
"""
connection = connection or self._data._block.session._bq_connection
connection = connection or self._data._block.session.bq_connection
return clients.get_canonical_bq_connection_id(
connection,
default_project=self._data._block.session._project,
Expand Down
12 changes: 11 additions & 1 deletion bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,16 @@ def _allows_ambiguity(self) -> bool:
def _anonymous_dataset(self):
return self._anon_dataset_manager.dataset

@property
def bq_connection(self) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep this as "private" by keeping that underscore prefix?

Plus, maybe we can have a test to cover this change?

msg = bfe.format_message(
f"""You are using the BigFrames session default connection: {self._bq_connection},
which can be different from the BigQuery project default connection.
This default connection may change in the future."""
)
warnings.warn(msg, category=FutureWarning)
return self._bq_connection

def __hash__(self):
# Stable hash needed to use in expression tree
return hash(str(self._session_id))
Expand Down Expand Up @@ -2253,7 +2263,7 @@ def _create_bq_connection(
) -> str:
"""Create the connection with the session settings and try to attach iam role to the connection SA.
If any of project, location or connection isn't specified, use the session defaults. Returns fully-qualified connection name."""
connection = self._bq_connection if not connection else connection
connection = self.bq_connection if not connection else connection
connection = bigframes.clients.get_canonical_bq_connection_id(
connection_id=connection,
default_project=self._project,
Expand Down
Loading