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 44
44
45
45
46
46
class 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.
49
51
"""
50
52
51
53
def __init__ (self , dataframe : bigframes .dataframe .DataFrame ):
@@ -74,15 +76,18 @@ def __init__(self, dataframe: bigframes.dataframe.DataFrame):
74
76
# Initialize data fetching attributes.
75
77
self ._batches = dataframe .to_pandas_batches (page_size = initial_page_size )
76
78
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
+
77
88
# set traitlets properties that trigger observers
78
89
self .page_size = initial_page_size
79
90
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
-
86
91
# get the initial page
87
92
self ._set_table_html ()
88
93
You can’t perform that action at this time.
0 commit comments