Skip to content

Conversation

@shuoweil
Copy link
Contributor

@shuoweil shuoweil commented Jul 24, 2025

This PR introduces enhancements to the TableWidget by improving its initialization and robustness, specifically addressing an AttributeError related to the _batches attribute.

Key improvements include:
Enhanced Initialization: Ensures the _batches attribute is correctly initialized in the TableWidget constructor by calling _reset_batches_for_new_page_size before it is accessed, making the widget more reliable from creation.
Improved Typing: Added explicit type hints for _batches to resolve MyPy errors, contributing to better code clarity and maintainability.
Refactored Batch Handling: Changed the to_pandas_batches call to the internal _to_pandas_batches to ensure the correct PandasBatches object is returned, satisfying type requirements and streamlining internal data handling.
Test Enhancements: Added new tests to verify the widget's row count is immutable after creation and that it gracefully handles cases with invalid total rows, ensuring the stability of the new functionality.

@shuoweil shuoweil self-assigned this Jul 24, 2025
@shuoweil shuoweil requested review from a team as code owners July 24, 2025 23:22
@shuoweil shuoweil requested a review from GarrettWu July 24, 2025 23:22
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Jul 24, 2025
@shuoweil shuoweil requested review from tswast and removed request for GarrettWu July 24, 2025 23:23
@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch from aee37a7 to 303c4af Compare July 24, 2025 23:23
@tswast
Copy link
Collaborator

tswast commented Jul 29, 2025

Please also update the benchmarks to use the total_rows parameter.

@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch from fc38cf3 to f643cfb Compare July 30, 2025 03:28
@shuoweil
Copy link
Contributor Author

shuoweil commented Jul 30, 2025

Please also update the benchmarks to use the total_rows parameter.

Let's use a separate PR for this request. #1949

@shuoweil shuoweil requested a review from tswast July 30, 2025 03:29
@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch 2 times, most recently from e12c8ff to f8ab27b Compare July 30, 2025 22:07
@shuoweil shuoweil added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 31, 2025
@bigframes-bot bigframes-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 31, 2025
@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch from f8ab27b to df85824 Compare July 31, 2025 04:32
@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch from df85824 to 2756968 Compare August 1, 2025 08:06
@shuoweil shuoweil requested a review from tswast August 1, 2025 08:07
@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch 7 times, most recently from 5bc65ce to 26eb25e Compare August 9, 2025 00:18
@shuoweil shuoweil force-pushed the shuowei-anywidget-remove-len-call branch from 42e0580 to 76cdec6 Compare October 24, 2025 21:20
@shuoweil shuoweil requested a review from tswast October 24, 2025 21:22
@shuoweil shuoweil changed the title feat: Resolve AttributeError in TableWidget and improve initialization fix: Resolve AttributeError in TableWidget and improve initialization Oct 27, 2025
@tswast tswast merged commit 4c4c9b1 into main Oct 27, 2025
25 checks passed
@tswast tswast deleted the shuowei-anywidget-remove-len-call branch October 27, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants