Support for COLMAP

COLMAP supports the following scenarios:

Replicating only specific columns is a very common use case, where you can specify columns that need to be mapped in the target, explicitly.

For example, consider that a source table has columns COL1, COL2, …, COL10 and you only want to create COL1 and COL5 in the target table, then you can add parameters similar to the following in the Replicat parameter file:

MAP SRC.TABLE, TARGET TGT.TABLE, COLMAP(COL1 = COL1, COL5 = COL5);

Consider the following examples:

MAP SRC.TABLE, TARGET TGT.TABLE, COLMAP (USEDEFAULTS, EMPNAME = COL10);

In this example, the COL10 field from the source table is mapped to EMPNAME in the target table using COLMAP, while all other columns retain their original names.

MAP SRC.REGION, TARGET TGT.EMPLOYEE, COLMAP (USEDEFAULTS, A001 = Å001);

In this example, notice that COLMAP is used to change the name of the column A001 to Å001, which contains a specific (unsupported) character.

An important consideration when using COLMAP to rename columns is the potential impact on future schema changes. If a new column with the same name, such as EMPNAME, is added to the source table, it will cause the Replicat process to fail because it attempts to create a duplicate column at the target.

While workarounds exist, such as creating additional mappings, they can lead to maintenance complexities. Therefore, it is recommended that you exercise caution when renaming columns using COLMAP. Consider adding new columns with appropriate names to avoid potential conflicts and ensure seamless replication.

The following is a possible workaround to address this conflict, however, it is strongly recommended not to rely on such solutions and instead recommend avoiding the scenario altogether by choosing unique and compatible column names across all databases.

MAP SRC.TABLE, TARGET TGT.TABLE, COLMAP (USEDEFAULTS, EMPNAME = COL10, EMPNAME_NEW = EMPNAME);