mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat: deprecate /superset/validate_sql_json migrate to api v1 (#19935)
* feat: deprecate /superset/validate_sql_json migrate to api v1 * use new error handling * migrate SQLLAb frontend and add tests * debug test * debug test * fix frontend test on sqllab * fix tests * fix frontend test on sqllab * fix tests * fix tests * fix tests * fix tests
This commit is contained in:
committed by
GitHub
parent
9376940282
commit
87a4379d0a
@@ -369,24 +369,19 @@ export function validateQuery(query) {
|
||||
dispatch(startQueryValidation(query));
|
||||
|
||||
const postPayload = {
|
||||
client_id: query.id,
|
||||
database_id: query.dbId,
|
||||
json: true,
|
||||
schema: query.schema,
|
||||
sql: query.sql,
|
||||
sql_editor_id: query.sqlEditorId,
|
||||
templateParams: query.templateParams,
|
||||
validate_only: true,
|
||||
template_params: query.templateParams,
|
||||
};
|
||||
|
||||
return SupersetClient.post({
|
||||
endpoint: `/superset/validate_sql_json/${window.location.search}`,
|
||||
postPayload,
|
||||
stringify: false,
|
||||
endpoint: `/api/v1/database/${query.dbId}/validate_sql`,
|
||||
body: JSON.stringify(postPayload),
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
.then(({ json }) => dispatch(queryValidationReturned(query, json)))
|
||||
.then(({ json }) => dispatch(queryValidationReturned(query, json.result)))
|
||||
.catch(response =>
|
||||
getClientErrorObject(response).then(error => {
|
||||
getClientErrorObject(response.result).then(error => {
|
||||
let message = error.error || error.statusText || t('Unknown error');
|
||||
if (message.includes('CSRF token')) {
|
||||
message = t(COMMON_ERR_MESSAGES.SESSION_TIMED_OUT);
|
||||
|
||||
Reference in New Issue
Block a user