This is an automated email from the ASF dual-hosted git repository. beto pushed a commit to branch explorable in repository https://gitbox.apache.org/repos/asf/superset.git
commit 822de23150c3a5de21b3c87f6892180a032a4a36 Author: Beto Dealmeida <[email protected]> AuthorDate: Tue Oct 7 10:35:29 2025 -0400 WIP --- superset/semantic_layers/snowflake_.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/superset/semantic_layers/snowflake_.py b/superset/semantic_layers/snowflake_.py index 198ba9d579..c0a098e8c1 100644 --- a/superset/semantic_layers/snowflake_.py +++ b/superset/semantic_layers/snowflake_.py @@ -365,15 +365,26 @@ class SnowflakeExplorable: def get_dimensions(self) -> set[Dimension]: """ Get the dimensions defined in the explorable. + + Even though Snowflake supports `SHOW SEMANTIC DIMENSIONS IN my_semantic_view`, + it doesn't return the expression of dimensions, so we use a slightly more + complicated query to get all the information we need in one go. """ dimensions: set[Dimension] = set() - query = f"SHOW SEMANTIC DIMENSIONS IN {self.uid};" + query = f""" + DESC SEMANTIC VIEW {self.uid()} + ->> SELECT "object_name", "property", "property_value" + FROM $1 + WHERE + "object_kind" = 'DIMENSION' AND + "property" IN ('COMMENT', 'DATA_TYPE', 'EXPRESSION', 'TABLE'); + """ # noqa: S608 + connection_parameters = get_connection_parameters(self.configuration) with connect(**connection_parameters) as connection: cursor = connection.cursor(DictCursor) rows = cursor.execute(query).fetchall() - print(rows) for name, group in itertools.groupby(rows, key=lambda x: x["object_name"]): attributes = defaultdict(set)
