FlyData Feature Series: How to Use the Replacement Rule

in Product
 • Updated on 

# The Replacement Rule

While transferring data, you may encounter certain load errors due to a character unsupported in Amazon Redshift. Perhaps you may need to obfuscate certain personal information before uploading your data to Amazon Redshift. Regardless of the specific situation, the need to replace characters before loading is a common one, and that is why we released the Replacement Rule feature, supported natively in the FlyData Console.

# How to Replace Characters Before Loading to Redshift

To replace characters before loading your data into Redshift, you simply have to set a custom replacement rule according to your needs. You can get to the Replacement Rules section by clicking on the “Advanced Options” in your Data Entries settings under your Dashboard. The Replacement Rule is defined via a JSON string that sets the table, the column, and replace_rules. Each of these keys will let FlyData know where to apply the replacement rule and what replacements to make.

[ { "table" : "users", "column" : "user_id", "replace_rules" : [ {"^-$" : null}, {"#$" : ""} ] }, { "table" : "orders", "column" : "name", "replace_rules" : [ {"^(.*)$":"\\1!"}} ] }, ]

The replace_rules key takes an array of replacement rules as a JSON object. The key is the regular expression (anything supported in Ruby) to match, and the value is the value to replace it by. The Replacement Rule can be used for both FlyData Sync and FlyData Autoload.

# Summary

We hope this article gave a quick introduction to the Replacement Rule feature. For the documentation on this feature, please visit the Replacement Rule docs page.

Worry-free replication from source to Redshift & Snowflake
Unlimited sync during trial
No credit-card required
World class support
Try FlyData for free
Amazon Partner Logo Certified AWS
Redshift partner
Get started. Try FlyData.
Quick setup. No credit card required. Unlimited sync during trial.
Fast and secure Enterprise-grade security and near real-time sync.
World-class support Proactive monitoring from technical experts, 24/7.
Straightforward pricing Pay for the rows you use, and nothing you don’t.