Example: change data in apps

Sometimes a seemingly trivial business requirement can become a never-ending rabbit hole. In this scenario, we examine what happens when an unexpected change in regulations can impact an organization's systems such as business applications, report writers, mobile and web applications, etc...

The business requirement is simple: we need to change anything that says "Czech Republic" to "Czechia", at least for anything visible to customers, regulators and line employees.


That doesn't sound so hard. Our first reaction might be to simply update the database and change every instance of "Czech Republic" to "Czechia", but anyone with experience in enterprise systems will know that things are rarely that simple. There may be code in the database (stored procedures and triggers) and in the various applications that access it, and that code may depend on the current value ("Czech Republic").

We therefore quickly discover that this value needs to be changed sometimes, but not all the time.

This type of situation can be handled with pinpoint accuracy by one or more filters in Gallium Data.

More specifically, a result filter can trivially be created to handle the conditional change. For instance, if we wanted this change to be done for everyone except database users whose ID starts with "fin-" :

if ( ! context.connectionContext.user.startsWith("fin-") && context.row.country === 'Czech Republic') {
context.row.country = 'Czechia';
}

This filter can be applied conditionally, based on a variety of conditions:

  • identity of the database user, or IP of the request, or anything else known about the current user, potentially from another system

  • behavior prior to the request -- for instance, we may know that an application that runs a specific database command needs a special behavior afterwards

  • explicit commands -- an application could set a variable or issue a specific command to change the behavior of the gateway

  • etc...


Depending on the underlying database, the same result may be achieved by changing the query instead, which can be more efficient, if less flexible. For instance, if the SQL query is:

select last_name, country from customer

we could replace the query with:

select last_name, replace(country, 'Czechia', 'Czech Republic') as country from customers