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
The following commit(s) were added to refs/heads/explorable by this push:
new fcf413d64b WIP
fcf413d64b is described below
commit fcf413d64bd61c7a4eef2d412237231c67d12097
Author: Beto Dealmeida <[email protected]>
AuthorDate: Fri Oct 3 15:35:56 2025 -0400
WIP
---
superset/semantic_layers/snowflake_.py | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/superset/semantic_layers/snowflake_.py
b/superset/semantic_layers/snowflake_.py
index 7f89dbf20b..0452347918 100644
--- a/superset/semantic_layers/snowflake_.py
+++ b/superset/semantic_layers/snowflake_.py
@@ -206,9 +206,8 @@ class SnowflakeSemanticLayer:
when connecting.
"""
cursor = connection.cursor()
- query = "SHOW DATABASES"
- cursor.execute(query)
- return {row[1] for row in cursor.fetchall()}
+ cursor.execute("SHOW DATABASES")
+ return {row[1] for row in cursor}
@classmethod
def _fetch_schemas(
@@ -228,8 +227,7 @@ class SnowflakeSemanticLayer:
FROM INFORMATION_SCHEMA.SCHEMATA
WHERE CATALOG_NAME = ?
"""
- cursor.execute(query, (database,))
- return {row[0] for row in cursor.fetchall()}
+ return {row[0] for row in cursor.execute(query, (database,))}
@classmethod
def _get_connection_parameters(
@@ -282,15 +280,35 @@ class SnowflakeSemanticLayer:
def __init__(self, configuration: SnowflakeConfiguration):
self.configuration = configuration
- def get_explorables(self) -> list[SnowflakeExplorable]:
+ def get_explorables(
+ self,
+ runtime_configuration: BaseModel,
+ ) -> list[SnowflakeExplorable]:
"""
Get a list of available explorables (databases/schemas).
"""
- pass
+ # create a new configuration with the runtime parameters
+ configuration = self.configuration.model_copy(
+ update=runtime_configuration.model_dump()
+ )
+
+ connection_parameters = self._get_connection_parameters(configuration)
+ with connect(**connection_parameters) as connection:
+ cursor = connection.cursor()
+ query = """
+ SHOW SEMANTIC VIEWS
+ ->> SELECT "name" FROM $1;
+ """
+ return [
+ SnowflakeExplorable(configuration, row[0])
+ for row in cursor.execute(query)
+ ]
class SnowflakeExplorable:
- pass
+ def __init__(self, configuration: SnowflakeConfiguration, name: str):
+ self.configuration = configuration
+ self.name = name
if __name__ == "__main__":