类 AbstractJdbcCatalog
- java.lang.Object
-
- org.apache.seatunnel.connectors.seatunnel.jdbc.catalog.AbstractJdbcCatalog
-
- 所有已实现的接口:
AutoCloseable,org.apache.seatunnel.api.table.catalog.Catalog
- 直接已知子类:
DamengCatalog,IrisCatalog,MySqlCatalog,OceanBaseMySqlCatalog,OracleCatalog,PostgresCatalog,RedshiftCatalog,SapHanaCatalog,SqlServerCatalog,XuguCatalog
public abstract class AbstractJdbcCatalog extends Object implements org.apache.seatunnel.api.table.catalog.Catalog
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interfaceAbstractJdbcCatalog.ResultSetConsumer<T>
-
字段概要
字段 修饰符和类型 字段 说明 protected StringbaseUrlprotected StringcatalogNameprotected Map<String,Connection>connectionMapprotected StringdefaultDatabaseprotected Optional<String>defaultSchemaprotected StringdefaultUrlprotected static Set<String>EXCLUDED_SCHEMASprotected Stringpwdprotected Stringsuffixprotected static Set<String>SYS_DATABASESprotected Stringusername
-
构造器概要
构造器 构造器 说明 AbstractJdbcCatalog(String catalogName, String username, String pwd, org.apache.seatunnel.common.utils.JdbcUrlUtil.UrlInfo urlInfo, String defaultSchema)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected org.apache.seatunnel.api.table.catalog.ColumnbuildColumn(ResultSet resultSet)protected voidbuildColumnsWithErrorCheck(org.apache.seatunnel.api.table.catalog.TablePath tablePath, ResultSet resultSet, org.apache.seatunnel.api.table.catalog.TableSchema.Builder builder)protected Map<String,String>buildConnectorOptions(org.apache.seatunnel.api.table.catalog.TablePath tablePath)voidclose()protected voidcloseDatabaseConnection(String databaseName)voidcreateDatabase(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfExists)protected voidcreateDatabaseInternal(String databaseName)voidcreateTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean ignoreIfExists)voidcreateTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean ignoreIfExists, boolean createIndex)protected voidcreateTableInternal(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean createIndex)booleandatabaseExists(String databaseName)voiddropDatabase(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfNotExists)protected voiddropDatabaseInternal(String databaseName)voiddropTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfNotExists)protected voiddropTableInternal(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected booleanexecuteInternal(String url, String sql)voidexecuteSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath, String sql)protected ConnectiongetConnection(String url)protected List<org.apache.seatunnel.api.table.catalog.ConstraintKey>getConstraintKeys(DatabaseMetaData metaData, String database, String schema, String table)protected List<org.apache.seatunnel.api.table.catalog.ConstraintKey>getConstraintKeys(DatabaseMetaData metaData, org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetCreateDatabaseSql(String databaseName)protected StringgetCreateTableSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean createIndex)protected List<String>getCreateTableSqls(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean createIndex)protected StringgetDatabaseWithConditionSql(String databaseName)StringgetDefaultDatabase()protected StringgetDropDatabaseSql(String databaseName)protected StringgetDropTableSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetExistDataSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetListDatabaseSql()protected StringgetListTableSql(String databaseName)protected StringgetOptionTableName(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected Optional<org.apache.seatunnel.api.table.catalog.PrimaryKey>getPrimaryKey(DatabaseMetaData metaData, String database, String schema, String table)protected Optional<org.apache.seatunnel.api.table.catalog.PrimaryKey>getPrimaryKey(DatabaseMetaData metaData, org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetSelectColumnsSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)org.apache.seatunnel.api.table.catalog.CatalogTablegetTable(String sqlQuery)org.apache.seatunnel.api.table.catalog.CatalogTablegetTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected org.apache.seatunnel.api.table.catalog.TableIdentifiergetTableIdentifier(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetTableName(ResultSet rs)protected StringgetTableName(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetTableWithConditionSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetTruncateTableSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)protected StringgetUrlFromDatabaseName(String databaseName)booleanisExistsData(org.apache.seatunnel.api.table.catalog.TablePath tablePath)List<String>listDatabases()List<String>listTables(String databaseName)Stringname()voidopen()org.apache.seatunnel.api.table.catalog.PreviewResultpreviewAction(org.apache.seatunnel.api.table.catalog.Catalog.ActionType actionType, org.apache.seatunnel.api.table.catalog.TablePath tablePath, Optional<org.apache.seatunnel.api.table.catalog.CatalogTable> catalogTable)protected booleanquerySQLResultExists(String dbUrl, String sql)protected List<String>queryString(String url, String sql, AbstractJdbcCatalog.ResultSetConsumer<String> consumer)booleantableExists(org.apache.seatunnel.api.table.catalog.TablePath tablePath)voidtruncateTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfNotExists)protected voidtruncateTableInternal(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
-
-
字段详细资料
-
catalogName
protected final String catalogName
-
defaultDatabase
protected final String defaultDatabase
-
username
protected final String username
-
pwd
protected final String pwd
-
baseUrl
protected final String baseUrl
-
suffix
protected final String suffix
-
defaultUrl
protected final String defaultUrl
-
connectionMap
protected final Map<String,Connection> connectionMap
-
-
方法详细资料
-
name
public String name()
- 指定者:
name在接口中org.apache.seatunnel.api.table.catalog.Catalog
-
getDefaultDatabase
public String getDefaultDatabase()
- 指定者:
getDefaultDatabase在接口中org.apache.seatunnel.api.table.catalog.Catalog
-
getConnection
protected Connection getConnection(String url)
-
open
public void open() throws org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
open在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
close
public void close() throws org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
getSelectColumnsSql
protected String getSelectColumnsSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
buildColumn
protected org.apache.seatunnel.api.table.catalog.Column buildColumn(ResultSet resultSet) throws SQLException
- 抛出:
SQLException
-
getTableIdentifier
protected org.apache.seatunnel.api.table.catalog.TableIdentifier getTableIdentifier(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
getTable
public org.apache.seatunnel.api.table.catalog.CatalogTable getTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException, org.apache.seatunnel.api.table.catalog.exception.TableNotExistException- 指定者:
getTable在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogExceptionorg.apache.seatunnel.api.table.catalog.exception.TableNotExistException
-
buildColumnsWithErrorCheck
protected void buildColumnsWithErrorCheck(org.apache.seatunnel.api.table.catalog.TablePath tablePath, ResultSet resultSet, org.apache.seatunnel.api.table.catalog.TableSchema.Builder builder) throws SQLException- 抛出:
SQLException
-
getPrimaryKey
protected Optional<org.apache.seatunnel.api.table.catalog.PrimaryKey> getPrimaryKey(DatabaseMetaData metaData, org.apache.seatunnel.api.table.catalog.TablePath tablePath) throws SQLException
- 抛出:
SQLException
-
getPrimaryKey
protected Optional<org.apache.seatunnel.api.table.catalog.PrimaryKey> getPrimaryKey(DatabaseMetaData metaData, String database, String schema, String table) throws SQLException
- 抛出:
SQLException
-
getConstraintKeys
protected List<org.apache.seatunnel.api.table.catalog.ConstraintKey> getConstraintKeys(DatabaseMetaData metaData, org.apache.seatunnel.api.table.catalog.TablePath tablePath) throws SQLException
- 抛出:
SQLException
-
getConstraintKeys
protected List<org.apache.seatunnel.api.table.catalog.ConstraintKey> getConstraintKeys(DatabaseMetaData metaData, String database, String schema, String table) throws SQLException
- 抛出:
SQLException
-
getListDatabaseSql
protected String getListDatabaseSql()
-
listDatabases
public List<String> listDatabases() throws org.apache.seatunnel.api.table.catalog.exception.CatalogException
- 指定者:
listDatabases在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
databaseExists
public boolean databaseExists(String databaseName) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException
- 指定者:
databaseExists在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
getTableWithConditionSql
protected String getTableWithConditionSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
getTableName
protected String getTableName(ResultSet rs) throws SQLException
- 抛出:
SQLException
-
getTableName
protected String getTableName(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
listTables
public List<String> listTables(String databaseName) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException, org.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistException
- 指定者:
listTables在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogExceptionorg.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistException
-
tableExists
public boolean tableExists(org.apache.seatunnel.api.table.catalog.TablePath tablePath) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
tableExists在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
createTable
public void createTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean ignoreIfExists) throws org.apache.seatunnel.api.table.catalog.exception.TableAlreadyExistException, org.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistException, org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
createTable在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.TableAlreadyExistExceptionorg.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistExceptionorg.apache.seatunnel.api.table.catalog.exception.CatalogException
-
createTable
public void createTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean ignoreIfExists, boolean createIndex) throws org.apache.seatunnel.api.table.catalog.exception.TableAlreadyExistException, org.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistException, org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
createTable在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.TableAlreadyExistExceptionorg.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistExceptionorg.apache.seatunnel.api.table.catalog.exception.CatalogException
-
getCreateTableSql
protected String getCreateTableSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean createIndex)
-
getCreateTableSqls
protected List<String> getCreateTableSqls(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean createIndex)
-
createTableInternal
protected void createTableInternal(org.apache.seatunnel.api.table.catalog.TablePath tablePath, org.apache.seatunnel.api.table.catalog.CatalogTable table, boolean createIndex) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
dropTable
public void dropTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfNotExists) throws org.apache.seatunnel.api.table.catalog.exception.TableNotExistException, org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
dropTable在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.TableNotExistExceptionorg.apache.seatunnel.api.table.catalog.exception.CatalogException
-
getDropTableSql
protected String getDropTableSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
dropTableInternal
protected void dropTableInternal(org.apache.seatunnel.api.table.catalog.TablePath tablePath) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
createDatabase
public void createDatabase(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfExists) throws org.apache.seatunnel.api.table.catalog.exception.DatabaseAlreadyExistException, org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
createDatabase在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.DatabaseAlreadyExistExceptionorg.apache.seatunnel.api.table.catalog.exception.CatalogException
-
createDatabaseInternal
protected void createDatabaseInternal(String databaseName)
-
closeDatabaseConnection
protected void closeDatabaseConnection(String databaseName)
-
truncateTable
public void truncateTable(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfNotExists) throws org.apache.seatunnel.api.table.catalog.exception.TableNotExistException, org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
truncateTable在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.TableNotExistExceptionorg.apache.seatunnel.api.table.catalog.exception.CatalogException
-
dropDatabase
public void dropDatabase(org.apache.seatunnel.api.table.catalog.TablePath tablePath, boolean ignoreIfNotExists) throws org.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistException, org.apache.seatunnel.api.table.catalog.exception.CatalogException- 指定者:
dropDatabase在接口中org.apache.seatunnel.api.table.catalog.Catalog- 抛出:
org.apache.seatunnel.api.table.catalog.exception.DatabaseNotExistExceptionorg.apache.seatunnel.api.table.catalog.exception.CatalogException
-
dropDatabaseInternal
protected void dropDatabaseInternal(String databaseName) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException
- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
getOptionTableName
protected String getOptionTableName(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
buildConnectorOptions
protected Map<String,String> buildConnectorOptions(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
queryString
protected List<String> queryString(String url, String sql, AbstractJdbcCatalog.ResultSetConsumer<String> consumer) throws SQLException
- 抛出:
SQLException
-
executeInternal
protected boolean executeInternal(String url, String sql) throws SQLException
- 抛出:
SQLException
-
getTable
public org.apache.seatunnel.api.table.catalog.CatalogTable getTable(String sqlQuery) throws SQLException
- 抛出:
SQLException
-
truncateTableInternal
protected void truncateTableInternal(org.apache.seatunnel.api.table.catalog.TablePath tablePath) throws org.apache.seatunnel.api.table.catalog.exception.CatalogException- 抛出:
org.apache.seatunnel.api.table.catalog.exception.CatalogException
-
getTruncateTableSql
protected String getTruncateTableSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
getExistDataSql
protected String getExistDataSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
-
executeSql
public void executeSql(org.apache.seatunnel.api.table.catalog.TablePath tablePath, String sql)- 指定者:
executeSql在接口中org.apache.seatunnel.api.table.catalog.Catalog
-
isExistsData
public boolean isExistsData(org.apache.seatunnel.api.table.catalog.TablePath tablePath)
- 指定者:
isExistsData在接口中org.apache.seatunnel.api.table.catalog.Catalog
-
previewAction
public org.apache.seatunnel.api.table.catalog.PreviewResult previewAction(org.apache.seatunnel.api.table.catalog.Catalog.ActionType actionType, org.apache.seatunnel.api.table.catalog.TablePath tablePath, Optional<org.apache.seatunnel.api.table.catalog.CatalogTable> catalogTable)- 指定者:
previewAction在接口中org.apache.seatunnel.api.table.catalog.Catalog
-
-