Shadow

Definition

  1. CREATE SHADOW RULE shadowRuleDefinition [, shadowRuleDefinition] ...
  2. ALTER SHADOW RULE shadowRuleDefinition [, shadowRuleDefinition] ...
  3. ALTER SHADOW ALGORITHM shadowAlgorithm [, shadowAlgorithm] ...
  4. DROP SHADOW RULE ruleName [, ruleName] ...
  5. DROP SHADOW ALGORITHM algorithmName [, algorithmName] ...
  6. shadowRuleDefinition: ruleName(resourceMapping, shadowTableRule [, shadowTableRule] ...)
  7. resourceMapping: SOURCE=resourceName, SHADOW=resourceName
  8. shadowTableRule: tableName(shadowAlgorithm [, shadowAlgorithm] ...)
  9. shadowAlgorithm: ([algorithmName, ] TYPE(NAME=shadowAlgorithmType, PROPERTIES([algorithmProperties] ...)))
  10. algorithmProperties: algorithmProperty [, algorithmProperty] ...
  11. algorithmProperty: key=value
  • Duplicate ruleName cannot be created
  • resourceMapping specifies the mapping relationship between the source database and the shadow library. You need to use the resource managed by RDL, please refer to resource
  • shadowAlgorithm can act on multiple shadowTableRule at the same time
  • If algorithmName is not specified, it will be automatically generated according to ruleName, tableName and shadowAlgorithmType
  • shadowAlgorithmType currently supports COLUMN_REGEX_MATCH and SIMPLE_NOTE
  • shadowTableRule can be reused by different shadowRuleDefinition, so when executing DROP SHADOW RULE, the corresponding shadowTableRule will not be removed
  • shadowAlgorithm can be reused by different shadowTableRule, so when executing ALTER SHADOW RULE, the corresponding shadowAlgorithm will not be removed

Example

  1. CREATE SHADOW RULE shadow_rule(
  2. SOURCE=demo_ds,
  3. SHADOW=demo_ds_shadow,
  4. t_order((simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", foo="bar"))),(TYPE(NAME=COLUMN_REGEX_MATCH, PROPERTIES("operation"="insert","column"="user_id", "regex"='[1]')))),
  5. t_order_item((TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", "foo"="bar")))));
  6. ALTER SHADOW RULE shadow_rule(
  7. SOURCE=demo_ds,
  8. SHADOW=demo_ds_shadow,
  9. t_order((simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", foo="bar"))),(TYPE(NAME=COLUMN_REGEX_MATCH, PROPERTIES("operation"="insert","column"="user_id", "regex"='[1]')))),
  10. t_order_item((TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", "foo"="bar")))));
  11. ALTER SHADOW ALGORITHM
  12. (simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", "foo"="bar"))),
  13. (user_id_match_algorithm, TYPE(NAME=COLUMN_REGEX_MATCH,PROPERTIES("operation"="insert", "column"="user_id", "regex"='[1]')));
  14. DROP SHADOW RULE shadow_rule;
  15. DROP SHADOW ALGORITHM simple_note_algorithm;