mirror of
https://github.com/apache/superset.git
synced 2026-05-12 11:25:56 +00:00
fix: save columns reference from sqllab save datasets flow (#24248)
This commit is contained in:
@@ -688,8 +688,9 @@ class DatasourceEditor extends React.PureComponent {
|
||||
}
|
||||
|
||||
updateColumns(cols) {
|
||||
// cols: Array<{column_name: string; is_dttm: boolean; type: string;}>
|
||||
const { databaseColumns } = this.state;
|
||||
const databaseColumnNames = cols.map(col => col.name);
|
||||
const databaseColumnNames = cols.map(col => col.column_name);
|
||||
const currentCols = databaseColumns.reduce(
|
||||
(agg, col) => ({
|
||||
...agg,
|
||||
@@ -706,18 +707,18 @@ class DatasourceEditor extends React.PureComponent {
|
||||
.filter(col => !databaseColumnNames.includes(col)),
|
||||
};
|
||||
cols.forEach(col => {
|
||||
const currentCol = currentCols[col.name];
|
||||
const currentCol = currentCols[col.column_name];
|
||||
if (!currentCol) {
|
||||
// new column
|
||||
finalColumns.push({
|
||||
id: shortid.generate(),
|
||||
column_name: col.name,
|
||||
column_name: col.column_name,
|
||||
type: col.type,
|
||||
groupby: true,
|
||||
filterable: true,
|
||||
is_dttm: col.is_dttm,
|
||||
});
|
||||
results.added.push(col.name);
|
||||
results.added.push(col.column_name);
|
||||
} else if (
|
||||
currentCol.type !== col.type ||
|
||||
(!currentCol.is_dttm && col.is_dttm)
|
||||
@@ -728,7 +729,7 @@ class DatasourceEditor extends React.PureComponent {
|
||||
type: col.type,
|
||||
is_dttm: currentCol.is_dttm || col.is_dttm,
|
||||
});
|
||||
results.modified.push(col.name);
|
||||
results.modified.push(col.column_name);
|
||||
} else {
|
||||
// unchanged
|
||||
finalColumns.push(currentCol);
|
||||
|
||||
Reference in New Issue
Block a user