public class MySqlSyncDatabaseAction extends SyncDatabaseActionBase
Action
which synchronize the whole MySQL database into one Paimon database.
You should specify MySQL source database in mySqlConfig
. See document
of flink-cdc-connectors for detailed keys and values.
For each MySQL table to be synchronized, if the corresponding Paimon table does not exist, this action will automatically create the table. Its schema will be derived from all specified MySQL tables. If the Paimon table already exists, its schema will be compared against the schema of all specified MySQL tables.
This action supports a limited number of schema changes. Currently, the framework can not drop columns, so the behaviors of `DROP` will be ignored, `RENAME` will add a new column. Currently supported schema changes includes:
This action creates a Paimon table sink for each Paimon table to be written, so this action is not very efficient in resource saving. We may optimize this action by merging all sinks into one instance in the future.
excludingTables, includingTables, mergeShards, mode, partitionKeyMultiple, partitionKeys, primaryKeys, tablePrefix, tables, tableSuffix
allowUpperCase, cdcSourceConfig, database, metadataConverters, syncJobHandler, tableConfig, typeMapping
batchTEnv, catalog, catalogName, catalogOptions, env, flinkCatalog
Constructor and Description |
---|
MySqlSyncDatabaseAction(String warehouse,
String database,
Map<String,String> catalogConfig,
Map<String,String> mySqlConfig) |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeBuildingSourceSink() |
protected org.apache.flink.cdc.connectors.mysql.source.MySqlSource<CdcSourceRecord> |
buildSource() |
protected CdcTimestampExtractor |
createCdcTimestampExtractor() |
List<Identifier> |
excludedTables() |
MySqlSyncDatabaseAction |
ignoreIncompatible(boolean ignoreIncompatible) |
List<Identifier> |
monitoredTables() |
protected boolean |
requirePrimaryKeys() |
buildEventParserFactory, buildSink, excludingTables, includingTables, mergeShards, recordParse, validateCaseSensitivity, withMode, withPartitionKeyMultiple, withPartitionKeys, withPrimaryKeys, withTablePrefix, withTableSuffix
alterTableOptions, build, run, tableConfig, validateRuntimeExecutionMode, withMetadataColumns, withTableConfig, withTypeMapping
catalogConfig, catalogLoader, compatibleCheck, execute, initFlinkCatalog, initFlinkEnv, initPaimonCatalog, toPaimonTypes, withStreamExecutionEnvironment
public MySqlSyncDatabaseAction ignoreIncompatible(boolean ignoreIncompatible)
protected void beforeBuildingSourceSink() throws Exception
beforeBuildingSourceSink
in class SynchronizationActionBase
Exception
protected CdcTimestampExtractor createCdcTimestampExtractor()
createCdcTimestampExtractor
in class SynchronizationActionBase
protected org.apache.flink.cdc.connectors.mysql.source.MySqlSource<CdcSourceRecord> buildSource()
buildSource
in class SynchronizationActionBase
@VisibleForTesting public List<Identifier> monitoredTables()
@VisibleForTesting public List<Identifier> excludedTables()
protected boolean requirePrimaryKeys()
requirePrimaryKeys
in class SyncDatabaseActionBase
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.