feat: 支持 TiDB、StarRocks

This commit is contained in:
taojinlong 2022-03-29 16:07:21 +08:00
parent 38905dcec8
commit 7e54842eab
3 changed files with 14 additions and 0 deletions

View File

@ -37,6 +37,8 @@ public class ProviderFactory implements ApplicationContextAware {
case mysql:
case mariadb:
case ds_doris:
case TiDB:
case StarRocks:
return context.getBean("mysqlQuery", QueryProvider.class);
case sqlServer:
return context.getBean("sqlserverQuery", QueryProvider.class);

View File

@ -229,6 +229,8 @@ public class JdbcProvider extends DatasourceProvider {
case engine_doris:
case ds_doris:
case mariadb:
case TiDB:
case StarRocks:
MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfiguration.class);
return mysqlConfiguration.getDataBase();
case sqlServer:
@ -429,6 +431,8 @@ public class JdbcProvider extends DatasourceProvider {
case engine_doris:
case engine_mysql:
case ds_doris:
case TiDB:
case StarRocks:
MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfiguration.class);
username = mysqlConfiguration.getUsername();
password = mysqlConfiguration.getPassword();
@ -541,6 +545,8 @@ public class JdbcProvider extends DatasourceProvider {
case engine_mysql:
case engine_doris:
case ds_doris:
case TiDB:
case StarRocks:
MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfiguration.class);
dataSource.setUrl(mysqlConfiguration.getJdbc());
dataSource.setDriverClassName(mysqlConfiguration.getDriver());
@ -623,10 +629,12 @@ public class JdbcProvider extends DatasourceProvider {
case mysql:
case engine_mysql:
case mariadb:
case TiDB:
JdbcConfiguration jdbcConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), JdbcConfiguration.class);
return String.format("SELECT TABLE_NAME,TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '%s' ;", jdbcConfiguration.getDataBase());
case engine_doris:
case ds_doris:
case StarRocks:
case hive:
case impala:
return "show tables";
@ -679,6 +687,8 @@ public class JdbcProvider extends DatasourceProvider {
case engine_mysql:
case ds_doris:
case ck:
case TiDB:
case StarRocks:
return null;
case sqlServer:
SqlServerConfiguration sqlServerConfiguration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfiguration.class);

View File

@ -399,6 +399,7 @@ export default {
},
allTypes: [
{name: 'mysql', label: 'MySQL', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
{name: 'TiDB', label: 'TiDB', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
{name: 'hive', label: 'Apache Hive', type: 'jdbc', extraParams: ''},
{name: 'impala', label: 'Apache Impala', type: 'jdbc', extraParams: 'AuthMech=0'},
{name: 'oracle', label: 'Oracle', type: 'jdbc'},
@ -406,6 +407,7 @@ export default {
{name: 'pg', label: 'PostgreSQL', type: 'jdbc', extraParams: ''},
{name: 'es', label: 'Elasticsearch', type: 'es'},
{name: 'mariadb', label: 'MariaDB', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
{name: 'StarRocks', label: 'StarRocks', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
{name: 'ds_doris', label: 'Doris', type: 'jdbc', extraParams: 'characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true'},
{name: 'ck', label: 'ClickHouse', type: 'jdbc', extraParams: ''},
{name: 'redshift', label: 'AWS Redshift', type: 'jdbc'},