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/02/02 18:36:20 UTC

[GitHub] [superset] etr2460 commented on a change in pull request #12840: feat: add separate endpoint to fetch function names for autocomplete

etr2460 commented on a change in pull request #12840:
URL: https://github.com/apache/superset/pull/12840#discussion_r568837306



##########
File path: superset-frontend/src/SqlLab/actions/sqlLab.js
##########
@@ -1300,3 +1302,23 @@ export function createCtasDatasource(vizOptions) {
       });
   };
 }
+
+export function queryEditorSetFunctionNames(queryEditor, dbId) {
+  return function (dispatch) {
+    return SupersetClient.get({
+      endpoint: encodeURI(`/api/v1/database/${dbId}/function_names/`),
+    })
+      .then(({ json }) =>
+        dispatch({
+          type: QUERY_EDITOR_SET_FUNCTION_NAMES,
+          queryEditor,
+          functionNames: json.function_names,
+        }),
+      )
+      .catch(() =>
+        dispatch(
+          addDangerToast(t('An error occurred while fetching function names')),

Review comment:
       nit: there should be a period in this sentence

##########
File path: superset/databases/schemas.py
##########
@@ -413,11 +413,15 @@ class DatabaseRelatedObjectsResponse(Schema):
     dashboards = fields.Nested(DatabaseRelatedDashboards)
 
 
+class DatabaseFunctionNamesResponse(Schema):
+    function_names = fields.List(fields.String())
+
+
 class ImportV1DatabaseExtraSchema(Schema):
     metadata_params = fields.Dict(keys=fields.Str(), values=fields.Raw())
     engine_params = fields.Dict(keys=fields.Str(), values=fields.Raw())
     metadata_cache_timeout = fields.Dict(keys=fields.Str(), values=fields.Integer())
-    schemas_allowed_for_csv_upload = fields.List(fields.String)
+    schemas_allowed_for_csv_upload = fields.List(fields.String())

Review comment:
       should this change be here? Also how is `fields.Str()` different from `fields.String()`?




----------------------------------------------------------------
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:
users@infra.apache.org



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