File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 4444
4545
4646class TableWidget (WIDGET_BASE ):
47- """
48- An interactive, paginated table widget for BigFrames DataFrames.
47+ """An interactive, paginated table widget for BigFrames DataFrames.
48+
49+ This widget provides a user-friendly way to display and navigate through
50+ large BigQuery DataFrames within a Jupyter environment.
4951 """
5052
5153 def __init__ (self , dataframe : bigframes .dataframe .DataFrame ):
@@ -74,15 +76,18 @@ def __init__(self, dataframe: bigframes.dataframe.DataFrame):
7476 # Initialize data fetching attributes.
7577 self ._batches = dataframe .to_pandas_batches (page_size = initial_page_size )
7678
79+ # Access total_rows through type casting (internal use only)
80+ from bigframes .core .blocks import PandasBatches
81+
82+ if isinstance (self ._batches , PandasBatches ):
83+ self .row_count = self ._batches .total_rows or 0
84+ else :
85+ # Fallback for compatibility
86+ self .row_count = 0
87+
7788 # set traitlets properties that trigger observers
7889 self .page_size = initial_page_size
7990
80- # len(dataframe) is expensive, since it will trigger a
81- # SELECT COUNT(*) query. It is a must have however.
82- # TODO(b/428238610): Start iterating over the result of `to_pandas_batches()`
83- # before we get here so that the count might already be cached.
84- self .row_count = len (dataframe )
85-
8691 # get the initial page
8792 self ._set_table_html ()
8893
You can’t perform that action at this time.
0 commit comments