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:
Ville Brofeldt
2020-10-27 07:58:38 +02:00
committed by GitHub
parent 8575439f48
commit ecdff724ea
5 changed files with 139 additions and 76 deletions

View File

@@ -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>