Skip to content

feat: support automatic per-cell execution history filtering and isolated callbacks#17144

Draft
shuoweil wants to merge 15 commits into
mainfrom
shuowei-filter-execution-history
Draft

feat: support automatic per-cell execution history filtering and isolated callbacks#17144
shuoweil wants to merge 15 commits into
mainfrom
shuowei-filter-execution-history

Conversation

@shuoweil
Copy link
Copy Markdown
Contributor

@shuoweil shuoweil commented May 14, 2026

This is a draft pr for pantheon testing. Please do not review it.

This PR introduces automatic cell-level isolation and execution history filtering for BigQuery DataFrames in notebook environments (Colab/Jupyter):

  • Per-Cell Filtering: bigframes.execution_history() now automatically isolates and filters query history to the active notebook cell (controlled via the new filter_by_cell parameter).
  • Isolated Callbacks: Added a callback parameter to _read_gbq_colab to support per-query execution event hooks that automatically clean up after execution completes.
  • Context Propagation: Preserves the active cell's execution_count inside ExecutionSpec and propagates it thread-safely to background executors and BigQuery event callbacks.

Verified at:
Before: screen/6BJNDbWRKrAQtLk
After: screen/3SaU4eq9ZZfriQt

Fixes #<513337964> 🦕

@shuoweil shuoweil self-assigned this May 14, 2026
@shuoweil shuoweil requested review from a team as code owners May 14, 2026 22:39
@shuoweil shuoweil requested review from tswast and removed request for a team and tswast May 14, 2026 22:39
@shuoweil shuoweil marked this pull request as draft May 14, 2026 22:39
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a callback parameter to the _read_gbq_colab function, allowing users to receive query execution events. The changes include updates to the public API, the session implementation, and the addition of a unit test to verify the callback functionality. A review comment suggests refactoring the _read_gbq_colab method to eliminate code duplication in the query execution logic by using a local helper function.

Comment thread packages/bigframes/bigframes/session/__init__.py Outdated
@shuoweil shuoweil force-pushed the shuowei-filter-execution-history branch from 96d6693 to d3bf48c Compare May 14, 2026 22:44
@shuoweil shuoweil changed the title feat: add callback parameter to _read_gbq_colab feat: support universal cell-level execution history filtering May 18, 2026
@shuoweil shuoweil changed the title feat: support universal cell-level execution history filtering feat: support automatic per-cell execution history filtering and isolated callbacks May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant