From faa9c21afc9da3eddcc59ce0bb10e5511cbb9d08 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Fri, 20 Aug 2021 11:43:57 +0300 Subject: [PATCH] fix: call external metadata endpoint with correct rison object (#16369) --- superset-frontend/src/datasource/DatasourceEditor.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx b/superset-frontend/src/datasource/DatasourceEditor.jsx index c59b6ad70b8fa..4bf2690cfa8fd 100644 --- a/superset-frontend/src/datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/datasource/DatasourceEditor.jsx @@ -493,11 +493,14 @@ class DatasourceEditor extends React.PureComponent { schema_name: datasource.schema, table_name: datasource.table_name, }; - const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode( + Object.entries(params).forEach(([key, value]) => { // rison can't encode the undefined value - Object.keys(params).map(key => - params[key] === undefined ? null : params[key], - ), + if (value === undefined) { + params[key] = null; + } + }); + const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode( + params, )}`; this.setState({ metadataLoading: true });