mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix(sqllab): throw errors of commented out query (#23378)
This commit is contained in:
@@ -353,6 +353,14 @@ export function fetchQueryResults(query, displayLimit) {
|
||||
};
|
||||
}
|
||||
|
||||
export function cleanSqlComments(sql) {
|
||||
if (!sql) return '';
|
||||
// it sanitizes the following comment block groups
|
||||
// group 1 -> /* */
|
||||
// group 2 -> --
|
||||
return sql.replace(/(--.*?$|\/\*[\s\S]*?\*\/)\n?/gm, '\n').trim();
|
||||
}
|
||||
|
||||
export function runQuery(query) {
|
||||
return function (dispatch) {
|
||||
dispatch(startQuery(query));
|
||||
@@ -362,7 +370,7 @@ export function runQuery(query) {
|
||||
json: true,
|
||||
runAsync: query.runAsync,
|
||||
schema: query.schema,
|
||||
sql: query.sql,
|
||||
sql: cleanSqlComments(query.sql),
|
||||
sql_editor_id: query.sqlEditorId,
|
||||
tab: query.tab,
|
||||
tmp_table_name: query.tempTable,
|
||||
|
||||
Reference in New Issue
Block a user