feat: add support for filters in sqlLab (#14765)

This commit is contained in:
cccs-jc
2021-06-01 14:23:51 -04:00
committed by GitHub
parent 66282c3313
commit eef489c667
3 changed files with 69 additions and 2 deletions

View File

@@ -271,9 +271,22 @@ export default class ResultSet extends React.PureComponent<
return;
}
const { schema, sql, dbId, templateParams } = this.props.query;
const { schema, sql, dbId } = this.props.query;
let { templateParams } = this.props.query;
const selectedColumns = this.props.query?.results?.selected_columns || [];
// The filters param is only used to test jinja templates.
// Remove the special filters entry from the templateParams
// before saving the dataset.
if (templateParams) {
const p = JSON.parse(templateParams);
if (p.filters) {
/* eslint-disable-next-line no-underscore-dangle */
delete p._filters;
templateParams = JSON.stringify(p);
}
}
this.props.actions
.createDatasource({
schema,