You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/08/13 09:07:00 UTC

[GitHub] [superset] zhaoyongjie commented on a change in pull request #16234: add function list to auto-complete to Clickhouse datasource

zhaoyongjie commented on a change in pull request #16234:
URL: https://github.com/apache/superset/pull/16234#discussion_r688362980



##########
File path: superset/db_engine_specs/clickhouse.py
##########
@@ -69,3 +76,33 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]:
         if tt == utils.TemporalType.DATETIME:
             return f"""toDateTime('{dttm.isoformat(sep=" ", timespec="seconds")}')"""
         return None
+
+
+    @classmethod
+    @cache_manager.cache.memoize()
+    def get_function_names(cls, database: "Database") -> List[str]:
+        """
+        Get a list of function names that are able to be called on the database.
+        Used for SQL Lab autocomplete.
+
+        :param database: The database to get functions for
+        :return: A list of function names usable in the database
+        """
+        df = database.get_df("SELECT name FROM system.functions")

Review comment:
       Here we should catch some exceptions. If the user does not have read access to the system table, an error will be thrown.




-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org