joe-clickhouse commented on code in PR #45983:
URL: https://github.com/apache/superset/pull/45983#discussion_r4457879938


##########
superset/db_engine_specs/clickhouse.py:
##########
@@ -623,6 +625,30 @@ class ClickHouseConnectEngineSpec(BasicParametersMixin, 
ClickHouseEngineSpec):
         ],
     }
 
+    @classmethod
+    def get_table_names(
+        cls,
+        database: Database,
+        inspector: Inspector,
+        schema: str | None,
+    ) -> set[str]:
+        """
+        Get all the real table names within the specified schema.
+
+        The clickhouse-connect dialect's `get_table_names` runs `SHOW TABLES`, 
which
+        includes views, and since clickhouse-connect 1.10.1 its 
`get_view_names`
+        returns them too; without this, every view is listed twice.
+
+        :param database: The database to inspect
+        :param inspector: The SQLAlchemy inspector
+        :param schema: The schema to inspect
+        :returns: The physical table names
+        """
+
+        return super().get_table_names(
+            database, inspector, schema
+        ) - cls.get_view_names(database, inspector, schema)

Review Comment:
   The subtraction is version-agnostic because every clickhouse-connect release 
before 1.10.1 returned an empty view list, so the only "breaking" version is 
also the one where the subtraction actually does do something, and Superset's 
pin already excludes the older ones. So we're good to go from my end!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] fix(cl... bxsx (via GitHub) via notifications
    • Re: [P... netlify[bot] (via GitHub) via notifications
    • Re: [P... codecov[bot] (via GitHub) via notifications
    • Re: [P... villebro (via GitHub) via notifications
    • Re: [P... villebro (via GitHub) via notifications
    • Re: [P... codeant-ai-for-open-source[bot] (via GitHub) via notifications
    • Re: [P... joe-clickhouse (via GitHub) via notifications

Reply via email to