mirror of
https://github.com/apache/superset.git
synced 2026-04-24 18:44:53 +00:00
feat: enable metadata sync for virtual tables (#10645)
* feat: enable metadata sync for virtual tables * add migration and check for empty schema name * simplify request * truncate trailing column attributes for MySQL * add unit test * use db_engine_spec func to truncate collation and charset * Remove redundant migration * add more tests * address review comments and apply templating to query * add todo for refactoring * remove schema from tests * check column datatype
This commit is contained in:
@@ -392,14 +392,9 @@ class DatasourceEditor extends React.PureComponent {
|
||||
|
||||
syncMetadata() {
|
||||
const { datasource } = this.state;
|
||||
// Handle carefully when the schema is empty
|
||||
const endpoint =
|
||||
`/datasource/external_metadata/${
|
||||
datasource.type || datasource.datasource_type
|
||||
}/${datasource.id}/` +
|
||||
`?db_id=${datasource.database.id}` +
|
||||
`&schema=${datasource.schema || ''}` +
|
||||
`&table_name=${datasource.datasource_name || datasource.table_name}`;
|
||||
const endpoint = `/datasource/external_metadata/${
|
||||
datasource.type || datasource.datasource_type
|
||||
}/${datasource.id}/`;
|
||||
this.setState({ metadataLoading: true });
|
||||
|
||||
SupersetClient.get({ endpoint })
|
||||
@@ -930,12 +925,6 @@ class DatasourceEditor extends React.PureComponent {
|
||||
buttonStyle="primary"
|
||||
onClick={this.syncMetadata}
|
||||
className="sync-from-source"
|
||||
disabled={!!datasource.sql}
|
||||
tooltip={
|
||||
datasource.sql
|
||||
? t('This option is not yet available for views')
|
||||
: null
|
||||
}
|
||||
>
|
||||
{t('Sync columns from source')}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user