From b28c4e81d67c717185ef06deca43271ad0a740b7 Mon Sep 17 00:00:00 2001 From: Eric Feiveson Date: Tue, 3 Feb 2026 15:56:20 -0800 Subject: [PATCH] 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. --- bigquery_magics/bigquery.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bigquery_magics/bigquery.py b/bigquery_magics/bigquery.py index c6d1d00..c60f327 100644 --- a/bigquery_magics/bigquery.py +++ b/bigquery_magics/bigquery.py @@ -680,9 +680,11 @@ def _add_graph_widget(query_result): try: from google.colab import output - output.register_callback("graph_visualization.Query", _colab_query_callback) output.register_callback( - "graph_visualization.NodeExpansion", _colab_node_expansion_callback + "bigquery.graph_visualization.Query", _colab_query_callback + ) + output.register_callback( + "bigquery.graph_visualization.NodeExpansion", _colab_node_expansion_callback ) # In colab mode, the Javascript doesn't use the port value we pass in, as there is no @@ -703,6 +705,13 @@ def _add_graph_widget(query_result): port=port, params=query_result.to_json().replace("\\", "\\\\").replace('"', '\\"'), ) + html_content = html_content.replace( + '"graph_visualization.Query"', '"bigquery.graph_visualization.Query"' + ) + html_content = html_content.replace( + '"graph_visualization.NodeExpansion"', + '"bigquery.graph_visualization.NodeExpansion"', + ) IPython.display.display(IPython.core.display.HTML(html_content))