You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/10/19 05:30:32 UTC

(superset) branch master updated: fix(semantic layers): return 400 for ambiguous variants in compatibility name check (#45426)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 297449d68e7 fix(semantic layers): return 400 for ambiguous variants in compatibility name check (#45426)
297449d68e7 is described below

commit 297449d68e7852b9ec669b0a82fa5cc2186108ac
Author: Joe Li <jo...@preset.io>
AuthorDate: Sun Oct 18 22:30:24 2026 -0700

    fix(semantic layers): return 400 for ambiguous variants in compatibility name check (#45426)
    
    Co-authored-by: Claude Opus 5.5 <no...@anthropic.com>
    Co-authored-by: Evan Rusackas <ev...@preset.io>
---
 superset/datasource/api.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/superset/datasource/api.py b/superset/datasource/api.py
index 493261458b0..febe282d004 100644
--- a/superset/datasource/api.py
+++ b/superset/datasource/api.py
@@ -576,7 +576,9 @@ class DatasourceRestApi(BaseSupersetApi):
         action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.compatible",
         log_to_statsd=False,
     )
-    def compatible(self, datasource_type: str, datasource_id: int) -> FlaskResponse:
+    def compatible(  # noqa: C901
+        self, datasource_type: str, datasource_id: int
+    ) -> FlaskResponse:
         """Return compatible members, refusing unknown selected names with a 400.
 
         Non-string entries in selection lists do not select datasource members.
@@ -678,13 +680,16 @@ class DatasourceRestApi(BaseSupersetApi):
                 )
             )
         if selected_dimensions:
-            selection_errors.extend(
-                validate_names(
-                    selected_dimensions,
-                    {dimension.column_name for dimension in datasource.columns},
-                    "dimension",
+            try:
+                selection_errors.extend(
+                    validate_names(
+                        selected_dimensions,
+                        {dimension.column_name for dimension in datasource.columns},
+                        "dimension",
+                    )
                 )
-            )
+            except AmbiguousDimensionError as ex:
+                return self.response(400, message=str(ex))
         if selection_errors:
             return self.response(400, message="; ".join(selection_errors))