villebro commented on a change in pull request #9033: feat: Add schema to 
function retrieval and implement for Snowflake
URL: 
https://github.com/apache/incubator-superset/pull/9033#discussion_r372780260
 
 

 ##########
 File path: superset/db_engine_specs/snowflake.py
 ##########
 @@ -74,3 +84,32 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> 
Optional[str]:
         if tt == "TIMESTAMP":
             return 
f"""TO_TIMESTAMP('{dttm.isoformat(timespec="microseconds")}')"""
         return None
+
+    @classmethod
+    @cache.memoize()
+    def get_function_names(
+        cls, database: "Database", schema: Optional[str]
+    ) -> List[str]:
+        """
+        Get a list of function names that are able to be called on the 
database.
+        Used for SQL Lab autocomplete. Returns global functions, excluding 
system
+        functions (starting with "SYSTEM$") and UDFs that are available in the 
chosen
+        schema.
+
+        :param database: The database to get functions for
+        :param schema: The schema to get functions for
+        :return: A list of function names useable in the database
+        """
+
+        def is_valid_function(func_row: pd.Series) -> bool:
+            func_schema, func_name = func_row["schema_name"], func_row["name"]
+            if func_regex.match(func_name) and (
+                func_schema in (None, "")
+                or schema is None
 
 Review comment:
   Also fixed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to