Hi,
I want to modify the ddl query table name. I am using the replaceText processor to modify the flowfile query table name. Currently I am able to achieve it because I have one source DB and only one table name I have changed in destination DB.
Like sourceDBName: nrpsubscriotion and tableName: status -> destinationDBName: nrpresport and tableName: subscription_status.
Now I have two source DB(1. nrpsubscriotion, 2. nrpuserorg) and both have same tableName: status. Now Source DB 2 , tableName in destination DB nrpreport has tableName: user_org_status.
I have stuck here , I am not getting how can define a condition to replce a tableName in DDL based on schema name and ddl query able name:
It should map like below:
1. SourceDBName: nrpsubscriotion and tableName: status -> destinationDBName: nrpresport and tableName: subscription_status.
Flow File input:
{
"type" : "ddl",
"timestamp" : 1658314685000,
"binlog_gtidset" : "e75d07af-eb37-11ec-9d1d-a86daa745b08:1-206",
"database" : "nrpsubscription",
"table_name" : null,
"table_id" : null,
"query" : "ALTER TABLE `status` ADD COLUMN `is_test` VARCHAR(255) NULL AFTER `code`"
}
Expected output:
{
"type" : "ddl",
"timestamp" : 1658314685000,
"binlog_gtidset" : "e75d07af-eb37-11ec-9d1d-a86daa745b08:1-206",
"database" : "nrpsubscription",
"table_name" : null,
"table_id" : null,
"query" : "ALTER TABLE `subscription_status` ADD COLUMN `is_test` VARCHAR(255) NULL AFTER `code`"
}
2. SourceDBName: nrpuserorg and tableName: status -> destinationDBName: nrpreport and tableName: user_org_status.
{
"type" : "ddl",
"timestamp" : 1658314686000,
"binlog_gtidset" : "e75d07af-eb37-11ec-9d1d-a86daa745b08:1-207",
"database" : "nrpuserorg",
"table_name" : null,
"table_id" : null,
"query" : "ALTER TABLE `status` ADD COLUMN `is_test` VARCHAR(255) NULL AFTER `code`"
}
Expected output:
{
"type" : "ddl",
"timestamp" : 1658314686000,
"binlog_gtidset" : "e75d07af-eb37-11ec-9d1d-a86daa745b08:1-207",
"database" : "nrpuserorgdb",
"table_name" : null,
"table_id" : null,
"query" : "ALTER TABLE `user_org_status` ADD COLUMN `is_test` VARCHAR(255) NULL AFTER `code`"
}