mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
[sql lab] fix partitionned table has no partitions (#2740)
This commit is contained in:
parent
e5584440ce
commit
5dbfdefae8
@ -254,11 +254,12 @@ export function addTable(query, tableName, schemaName) {
|
||||
queryEditorId: query.id,
|
||||
schema: schemaName,
|
||||
name: tableName,
|
||||
};
|
||||
dispatch(mergeTable(Object.assign({}, table, {
|
||||
isMetadataLoading: true,
|
||||
isExtraMetadataLoading: true,
|
||||
expanded: false,
|
||||
};
|
||||
dispatch(mergeTable(table));
|
||||
})));
|
||||
|
||||
let url = `/superset/table/${query.dbId}/${tableName}/${schemaName}/`;
|
||||
$.get(url, (data) => {
|
||||
@ -273,15 +274,19 @@ export function addTable(query, tableName, schemaName) {
|
||||
ctas: false,
|
||||
};
|
||||
// Merge table to tables in state
|
||||
table = Object.assign({}, table, data, {
|
||||
const newTable = Object.assign({}, table, data, {
|
||||
expanded: true,
|
||||
isMetadataLoading: false,
|
||||
});
|
||||
dispatch(mergeTable(table, dataPreviewQuery));
|
||||
dispatch(mergeTable(newTable, dataPreviewQuery));
|
||||
// Run query to get preview data for table
|
||||
dispatch(runQuery(dataPreviewQuery));
|
||||
})
|
||||
.fail(() => {
|
||||
const newTable = Object.assign({}, table, {
|
||||
isMetadataLoading: false,
|
||||
});
|
||||
dispatch(mergeTable(newTable));
|
||||
notify.error('Error occurred while fetching table metadata');
|
||||
});
|
||||
|
||||
@ -289,6 +294,13 @@ export function addTable(query, tableName, schemaName) {
|
||||
$.get(url, (data) => {
|
||||
table = Object.assign({}, table, data, { isExtraMetadataLoading: false });
|
||||
dispatch(mergeTable(table));
|
||||
})
|
||||
.fail(() => {
|
||||
const newTable = Object.assign({}, table, {
|
||||
isExtraMetadataLoading: false,
|
||||
});
|
||||
dispatch(mergeTable(newTable));
|
||||
notify.error('Error occurred while fetching table metadata');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -540,7 +540,9 @@ class PrestoEngineSpec(BaseEngineSpec):
|
||||
|
||||
@classmethod
|
||||
def _latest_partition_from_df(cls, df):
|
||||
return df.to_records(index=False)[0][0]
|
||||
recs = df.to_records(index=False)
|
||||
if recs:
|
||||
return recs[0][0]
|
||||
|
||||
@classmethod
|
||||
def latest_partition(cls, table_name, schema, database, show_first=False):
|
||||
|
Loading…
Reference in New Issue
Block a user