Striim 3.9.4 / 3.9.5 documentation

Modifying and masking values in the WAEvent data array

When a CDC reader's output is the input of a writer, you may insert a CQ between the two to modify the values in the WAEvent's data array. This provides more flexibility when replicating data.

In this context, the syntax for the SELECT statement is:

SELECT * FROM <stream name> MODIFY (data[<field number>] = <expression>,...)
  • Preceed the CREATE CQ statement with a CREATE STREAM <name> OF TYPE Global.WAEvent statement that creates the output stream for the CQ.

  • Start the SELECT statement with SELECT * FROM <stream name>.

  • data[<field number>] specifies the field of the array to be modified. Fields are numbered starting with 0.

  • The expression can use the same operators and functions as SELECT.

  • The MODIFY clause may include CASE statements.

The following simple example would convert a monetary amount in the data[4] field using an exchange rate of 1.09:

CREATE CQ ConvertAmount 
INSERT INTO ConvertedStream
MODIFY(data[4] = TO_FLOAT(data[4]) * 1.09);

The next example illustrates the use of masking functions and CASE statements. It uses the maskPhoneNumber function (see Masking functions) to mask individually identifiable information from US and India telephone numbers (as dialed from the US) while preserving the country and area codes. The US numbers have the format ###-###-####, where the first three digits are the area code. India numbers have the format 91-###-###-####, where 91 is the country code and the third through fifth digits are the subscriber trunk dialing (STD) code. The telephone numbers are in data[4] and the country codes are in data[5].

CREATE STREAM MaskedStream OF Global.WAEvent;
CREATE CQ maskData 
INSERT INTO maskedDataStream
data[4] = CASE
    WHEN TO_STRING(data[5]) == "US" THEN maskPhoneNumber(TO_STRING(data[4]), "###-xxx-xxx")
    ELSE maskPhoneNumber(TO_STRING(data[4]), "#####x#xxx#xxxx")

This could be extended with additional WHEN statements to mask numbers from additional countries, or with additional masking functions to mask individually identifiable information such as credit card, Social Security, and national identification numbers.

See Masking functions for additional examples.