Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 522640a

Browse files
committed
chore: Make the name of the colab endpoint unique between BigQuery and Spanner. This avoids clashes if the same notebook uses visualizers for both BigQuery graphs and Spanner graphs, which can cause malfunctions in the visualizers.
1 parent 4aea24d commit 522640a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

bigquery_magics/bigquery.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,9 @@ def _add_graph_widget(query_result):
680680
try:
681681
from google.colab import output
682682

683-
output.register_callback("graph_visualization.Query", _colab_query_callback)
683+
output.register_callback("bigquery.graph_visualization.Query", _colab_query_callback)
684684
output.register_callback(
685-
"graph_visualization.NodeExpansion", _colab_node_expansion_callback
685+
"bigquery.graph_visualization.NodeExpansion", _colab_node_expansion_callback
686686
)
687687

688688
# In colab mode, the Javascript doesn't use the port value we pass in, as there is no
@@ -703,6 +703,12 @@ def _add_graph_widget(query_result):
703703
port=port,
704704
params=query_result.to_json().replace("\\", "\\\\").replace('"', '\\"'),
705705
)
706+
html_content = html_content.replace(
707+
'"graph_visualization.Query"', '"bigquery.graph_visualization.Query"'
708+
)
709+
html_content = html_content.replace(
710+
'"graph_visualization.NodeExpansion"', '"bigquery.graph_visualization.NodeExpansion"'
711+
)
706712
IPython.display.display(IPython.core.display.HTML(html_content))
707713

708714

0 commit comments

Comments
 (0)