File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 2323from bigframes .session import connect , Session
2424from bigframes .version import __version__
2525
26- _MAGIC_NAMES = ["bigframes " ]
26+ _MAGIC_NAMES = ["bigquery_sql " ]
2727
2828
2929def load_ipython_extension (ipython ):
Original file line number Diff line number Diff line change @@ -40,12 +40,17 @@ def _cell_magic(line, cell):
4040 args = magic_arguments .parse_argstring (_cell_magic , line )
4141 if not cell :
4242 print ("Query is missing." )
43+ return
4344 pyformat_args = ipython .user_ns
4445 dataframe = bigframes .pandas ._read_gbq_colab (
4546 cell , pyformat_args = pyformat_args , dry_run = args .dry_run
4647 )
4748 if args .destination_var :
4849 ipython .push ({args .destination_var : dataframe })
4950 else :
50- display (dataframe )
51- return dataframe
51+ with bigframes .option_context (
52+ "display.repr_mode" ,
53+ "anywidget" ,
54+ ):
55+ display (dataframe )
56+ return
Original file line number Diff line number Diff line change 4949import pyarrow as pa
5050
5151import bigframes ._config as config
52+ import bigframes ._importing
5253import bigframes .core .global_session as global_session
5354import bigframes .core .indexes
5455import bigframes .dataframe
@@ -356,8 +357,12 @@ def _read_gbq_colab(
356357 with warnings .catch_warnings ():
357358 # Don't warning about Polars in SQL cell.
358359 # Related to b/437090788.
359- warnings .simplefilter ("ignore" , bigframes .exceptions .PreviewWarning )
360- config .options .bigquery .enable_polars_execution = True
360+ try :
361+ bigframes ._importing .import_polars ()
362+ warnings .simplefilter ("ignore" , bigframes .exceptions .PreviewWarning )
363+ config .options .bigquery .enable_polars_execution = True
364+ except TypeError :
365+ pass # don't fail if polars isn't available
361366
362367 return global_session .with_default_session (
363368 bigframes .session .Session ._read_gbq_colab ,
Original file line number Diff line number Diff line change 2020import bigframes
2121import bigframes .pandas as bpd
2222
23- MAGIC_NAME = "bigframes "
23+ MAGIC_NAME = "bigquery_sql "
2424
2525
2626@pytest .fixture (scope = "module" )
You can’t perform that action at this time.
0 commit comments