Conversation
…d Spanner. This avoids clashes if the same notebook uses visualizers for both BigQuery graphs and Spanner graphs, which can cause malfunctions in the visualizers.
There was a problem hiding this comment.
Code Review
This pull request makes the Colab endpoint names for graph visualization unique for BigQuery to avoid clashes with Spanner. The changes correctly update the callback registration and the generated HTML. My review includes one suggestion to improve maintainability by replacing duplicated hardcoded strings with constants.
There was a problem hiding this comment.
The callback names are hardcoded here and also when registering the callbacks on lines 683 and 685. To improve maintainability and prevent potential bugs if these names need to be changed in the future, it would be better to define these strings as constants at the module level and reuse them in all relevant places.
For example:
# At module level
_BQ_GRAPH_QUERY_CALLBACK = "bigquery.graph_visualization.Query"
_BQ_GRAPH_NODE_EXPANSION_CALLBACK = "bigquery.graph_visualization.NodeExpansion"
_SPANNER_GRAPH_QUERY_CALLBACK = "graph_visualization.Query"
_SPANNER_GRAPH_NODE_EXPANSION_CALLBACK = "graph_visualization.NodeExpansion"
# In _add_graph_widget()
...
output.register_callback(_BQ_GRAPH_QUERY_CALLBACK, _colab_query_callback)
...
html_content = html_content.replace(
f'\"{_SPANNER_GRAPH_QUERY_CALLBACK}\"', f'\"{_BQ_GRAPH_QUERY_CALLBACK}\"'
)
...PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v0.8.0 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:1a2a85ab507aea26d787c06cc7979decb117164c81dd78a745982dfda80d4f68 <details><summary>bigquery-magics: 0.12.0</summary> ## [0.12.0](v0.11.0...v0.12.0) (2026-02-10) ### Features * support schema view (#211) ([8e1883e](8e1883ee)) * remove bqsql magic to make that name available for bigframes (#210) ([c46c94a](c46c94af)) ### Bug Fixes * reduce conflicts between Spanner and BigQuery graph visualization on Colab (#209) ([7dca7b1](7dca7b13)) </details>

…d Spanner. This avoids clashes if the same notebook uses visualizers for both BigQuery graphs and Spanner graphs, which can cause malfunctions in the visualizers.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕