diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index fa373b5242de6..ce201e89d904c 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -171,17 +171,17 @@ class AceEditorWrapper extends React.PureComponent { meta: 'schema', })); const columns = {}; - const tables = props.tables || []; - const extendedTables = props.extendedTables || []; + const tables = props.extendedTables || props.tables || []; + const tableWords = tables.map(t => { - const tableName = t.value; - const extendedTable = extendedTables.find(et => et.name === tableName); - const cols = (extendedTable && extendedTable.columns) || []; + const tableName = t.name; + const cols = t.columns || []; cols.forEach(col => { columns[col.name] = null; // using an object as a unique set }); + return { - name: t.label, + name: tableName, value: tableName, score: TABLE_AUTOCOMPLETE_SCORE, meta: 'table',