Skip to content

Commit

Permalink
chore: deprecate /superset/fetch_datasource_metadata mig to API v1 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar authored Nov 14, 2022
1 parent 5b67e07 commit 7c6fabb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 6 additions & 5 deletions superset-frontend/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -1409,17 +1409,18 @@ export function popQuery(queryId) {
}
export function popDatasourceQuery(datasourceKey, sql) {
return function (dispatch) {
const datasetId = datasourceKey.split('__')[0];
return SupersetClient.get({
endpoint: `/superset/fetch_datasource_metadata?datasourceKey=${datasourceKey}`,
endpoint: `/api/v1/dataset/${datasetId}?q=(keys:!(none))`,
})
.then(({ json }) =>
dispatch(
addQueryEditor({
name: `Query ${json.name}`,
dbId: json.database.id,
schema: json.schema,
name: `Query ${json.result.name}`,
dbId: json.result.database.id,
schema: json.result.schema,
autorun: sql !== undefined,
sql: sql || json.select_star,
sql: sql || json.result.select_star,
}),
),
)
Expand Down
1 change: 1 addition & 0 deletions superset/datasets/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class DatasetRestApi(BaseSupersetModelRestApi):
"cache_timeout",
"is_sqllab_view",
"template_params",
"select_star",
"owners.id",
"owners.username",
"owners.first_name",
Expand Down
5 changes: 5 additions & 0 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2598,6 +2598,11 @@ def fetch_datasource_metadata(self) -> FlaskResponse: # pylint: disable=no-self
:returns: The Flask response
:raises SupersetSecurityException: If the user cannot access the resource
"""
logger.warning(
"%s.fetch_datasource_metadata "
"This API endpoint is deprecated and will be removed in version 3.0.0",
self.__class__.__name__,
)

datasource_id, datasource_type = request.args["datasourceKey"].split("__")
datasource = DatasourceDAO.get_datasource(
Expand Down

0 comments on commit 7c6fabb

Please sign in to comment.