Skip to content

Commit 586a6f9

Browse files
committed
docs: add bigframes default connection warning
1 parent a951249 commit 586a6f9

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

bigframes/core/blocks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def reset_index(
442442
level_ids = self.index_columns
443443

444444
expr = self._expr
445-
replacement_idx_type = replacement or self.session._default_index_type
445+
replacement_idx_type = replacement or self.session._default_index_type # type: ignore
446446
if set(self.index_columns) > set(level_ids):
447447
new_index_cols = [col for col in self.index_columns if col not in level_ids]
448448
new_index_labels = [self.col_id_to_index_name[id] for id in new_index_cols]
@@ -2382,7 +2382,7 @@ def merge(
23822382
if (
23832383
self.index.is_null
23842384
or other.index.is_null
2385-
or self.session._default_index_type == bigframes.enums.DefaultIndexKind.NULL
2385+
or self.session._default_index_type == bigframes.enums.DefaultIndexKind.NULL # type: ignore
23862386
):
23872387
return Block(joined_expr, index_columns=[], column_labels=labels)
23882388
elif index_cols:

bigframes/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4233,7 +4233,7 @@ def to_gbq(
42334233

42344234
# The client code owns this table reference now
42354235
temp_table_ref = (
4236-
self._session._anon_dataset_manager.generate_unique_resource_id()
4236+
self._session._anon_dataset_manager.generate_unique_resource_id() # type: ignore
42374237
)
42384238
destination_table = f"{temp_table_ref.project}.{temp_table_ref.dataset_id}.{temp_table_ref.table_id}"
42394239

bigframes/session/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,18 @@ def _allows_ambiguity(self) -> bool:
374374
def _anonymous_dataset(self):
375375
return self._anon_dataset_manager.dataset
376376

377+
@property
378+
def _bq_connection(self) -> str:
379+
msg = bfe.format_message(
380+
f"You are using the BigFrames session default connection: {self._bq_connection}, which can be different from the BigQuery project default connection."
381+
)
382+
warnings.warn(msg, category=FutureWarning)
383+
return self._bq_connection
384+
385+
@_bq_connection.setter
386+
def _bq_connection(self, value):
387+
self._bq_connection = value
388+
377389
def __hash__(self):
378390
# Stable hash needed to use in expression tree
379391
return hash(str(self._session_id))

0 commit comments

Comments
 (0)