11.4.32. Rename Filter

The rename filter enables schemas to
be renamed at the database, table and column levels, and for complex
combinations of these renaming operations. Configuration is through a CSV
file that defines the rename parameters. A single CSV file can contain
multiple rename definitions. The rename operations occur only on ROW based
events.

Version Support: 2.2.1 and later

The rename filter also performs
schema renames on statement data only in
Tungsten Replicator 2.2.1.

originalSchema,
originalTable,
originalColumn define the
original schema, table and column.

Definition can either be:

Explicit schema, table or column name

* character, which indicates
that all entries should match.

newSchema,
newTable,
newColumn define the new schema,
table and column for the corresponding original specification.

Definition can either be:

Explicit schema, table or column name

- character, which indicates
that the corresponding object should not be updated.

For example, the specification:

*,chicago,*,-,newyork,-

Would rename the table chicago in
every database schema to newyork.
The schema and column names are not modified.

The specification:

*,chicago,destination,-,-,source

Would match all schemas, but update the column
destination in the table
chicago to the column name
source, without changing the schema
or table name.

Processing of the individual rules is executed in a specific order to
allow for complex matching and application of the rename changes.

Rules are case sensitive.

Schema names are looked up in the following order:

schema.table (explicit
schema/table)

schema.* (explicit schema,
wildcard table)

Table names are looked up in the following order:

schema.table (explicit
schema/table)

*.table (wildcard schema,
explicit table)

Column names are looked up in the following order:

schema.table (explicit
schema/table)

schema.* (explicit schema,
wildcard table)

*.table (wildcard schema,
explicit table)

*.* (wildcard schema,
wildcard table)

Rename operations match the first specification according to the above
rules, and only one matching rule is executed.

11.4.32.1. Rename Filter Examples

When processing multiple entries that would match the same definition,
the above ordering rules are applied. For example, the definition:

asia,*,*,america,-,-
asia,shanghai,*,europe,-,-

Would rename asia.shanghai to
europe.shanghai, while renaming
all other tables in the schema
asia to the schema
america. This is because the
explicit schema.table rule is
matched first and then executed.

Complex renames involving multiple schemas, tables and columns can be
achieved by writing multiple rules into the same CSV file. For example
given a schema where all the tables currently reside in a single schema,
but must be renamed to specific continents, or to a 'miscellaneous'
schema, while also updating the column names to be more neutral would
require a detailed rename definition.

Meanwhile, the table definition needs to be updated to support more
complex structure:

id
area
country
city
value
type

The area is being updated to contain the region within the country,
while the value should be renamed to the three-letter currency code, for
example, the london table would
rename the value column to
gbp.

The definition can be divided up into simple definitions at each object
level, relying on the processing order to handle the individual
exceptions. Starting with the table renames for the continents: