feat(bigquery-magics): deprecate `--engine=bigframes`, run `%load_ext… · googleapis/google-cloud-python@dbaf8f5 · GitHub
Skip to content

Commit dbaf8f5

Browse files
feat(bigquery-magics): deprecate --engine=bigframes, run %load_ext bigframes and use %%bqsql magics instead (#16573)
Towards internal issue b/500399391 🦕 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 32d9f7e commit dbaf8f5

3 files changed

Lines changed: 110 additions & 6 deletions

File tree

packages/bigquery-magics/bigquery_magics/bigquery.py

Lines changed: 15 additions & 4 deletions

packages/bigquery-magics/bigquery_magics/config.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from dataclasses import dataclass
1616
from typing import Optional
17+
import warnings
1718

1819
import google.api_core.client_options as client_options
1920
import google.cloud.bigquery as bigquery
@@ -183,10 +184,15 @@ def project(self, value):
183184

184185
@property
185186
def engine(self) -> str:
186-
"""Engine to run the query. Could either be "pandas" or "bigframes".
187+
"""[Deprecated] Engine to run the query. Could either be "pandas" or
188+
"bigframes".
187189
188190
If using "pandas", the query result will be stored in a Pandas dataframe.
189-
If using "bigframes", the query result will be stored in a bigframes dataframe instead.
191+
If using "bigframes", the query result will be stored in a bigframes
192+
dataframe instead.
193+
194+
Please use ``%load_ext bigframes`` and the ``%%bqsql`` magic instead.
195+
See: https://dataframes.bigquery.dev/notebooks/getting_started/magics.html
190196
191197
Example:
192198
Manully setting the content engine:
@@ -200,6 +206,14 @@ def engine(self) -> str:
200206
def engine(self, value):
201207
if value != "pandas" and value != "bigframes":
202208
raise ValueError("engine must be either 'pandas' or 'bigframes'")
209+
if value == "bigframes":
210+
warnings.warn(
211+
"The bigframes engine is deprecated. Please use %load_ext bigframes "
212+
"and the %%bqsql magic instead. "
213+
"See: https://dataframes.bigquery.dev/notebooks/getting_started/magics.html",
214+
FutureWarning,
215+
stacklevel=2,
216+
)
203217
self._engine = value
204218

205219

Lines changed: 79 additions & 0 deletions

0 commit comments

Comments
 (0)