Commit 7d44011
authored
feat: support automatic per-cell execution history filtering and isolated callbacks (#17144)
This change introduces scoped query tracking and event callback
management for BigQuery DataFrames within interactive notebook
environments (Jupyter/Colab).
Key Changes
- Jupyter Cell Scoping: Resolves and carries the active IPython cell
execution count (cell_execution_count) through TableWidget,
ExecutionSpec, query executors, and final JobMetadata.
- Execution History Filtering: Adds events, job_ids, and all_cells
parameters to session.execution_history(). When all_cells=False, it
filters query logs down to the current active notebook cell.
- Scoped Callback Support: Adds a callback parameter to _read_gbq_colab
that automatically subscribes to the query progress publisher during
execution and automatically unsubscribes upon completion.
- Robustness Fixes:
1. Instantiates expected schema/columns in _ExecutionHistory even when
the dataframe is empty to prevent indexing errors.
2. Converts custom option mappings to native Python dicts when assigning
query labels to avoid validation errors in the underlying BigQuery
client.
3. Captures and propagates query_id in BigQueryFinishedEvent.
Verified at:
[go/scrcast/NjQzOTAzMTUwMzA2MDk5MnwzZWQ2MTMzYS0xYg](http://goto.google.com/scrcast/NjQzOTAzMTUwMzA2MDk5MnwzZWQ2MTMzYS0xYg)
Colab notebook test: screen/7d6Yt3C28BUAKEH
Fixes #<513337964> 🦕1 parent c7bb44c commit 7d44011
18 files changed
Lines changed: 424 additions & 56 deletions
File tree
- packages/bigframes
- bigframes
- core
- display
- pandas/io
- session
- _io/bigquery
- tests/unit
- display
- session
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
| 699 | + | |
699 | 700 | | |
700 | 701 | | |
701 | 702 | | |
| |||
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
| 717 | + | |
716 | 718 | | |
717 | 719 | | |
718 | 720 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
130 | 143 | | |
131 | 144 | | |
| 145 | + | |
132 | 146 | | |
133 | 147 | | |
134 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1755 | 1755 | | |
1756 | 1756 | | |
1757 | 1757 | | |
| 1758 | + | |
1758 | 1759 | | |
1759 | 1760 | | |
1760 | 1761 | | |
| |||
1807 | 1808 | | |
1808 | 1809 | | |
1809 | 1810 | | |
| 1811 | + | |
1810 | 1812 | | |
1811 | 1813 | | |
1812 | 1814 | | |
| |||
1815 | 1817 | | |
1816 | 1818 | | |
1817 | 1819 | | |
| 1820 | + | |
1818 | 1821 | | |
1819 | 1822 | | |
1820 | 1823 | | |
1821 | 1824 | | |
1822 | 1825 | | |
| 1826 | + | |
1823 | 1827 | | |
1824 | 1828 | | |
1825 | 1829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
286 | 290 | | |
287 | 291 | | |
288 | 292 | | |
289 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
290 | 297 | | |
291 | 298 | | |
292 | 299 | | |
| |||
318 | 325 | | |
319 | 326 | | |
320 | 327 | | |
321 | | - | |
| 328 | + | |
| 329 | + | |
322 | 330 | | |
323 | 331 | | |
324 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
305 | 306 | | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
311 | 312 | | |
312 | | - | |
313 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
| 322 | + | |
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
| |||
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| 334 | + | |
| 335 | + | |
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
| |||
379 | 384 | | |
380 | 385 | | |
381 | 386 | | |
| 387 | + | |
382 | 388 | | |
383 | 389 | | |
384 | 390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
| 763 | + | |
763 | 764 | | |
764 | 765 | | |
765 | 766 | | |
| |||
812 | 813 | | |
813 | 814 | | |
814 | 815 | | |
| 816 | + | |
815 | 817 | | |
816 | 818 | | |
817 | 819 | | |
| |||
0 commit comments