ALTER SHADOW RULE

Description

The ALTER SHADOW RULE syntax is used to alter shadow rule.

Syntax

Grammar Railroad diagram

  1. AlterShadowRule ::=
  2. 'ALTER' 'SHADOW' 'RULE' shadowRuleDefinition (',' shadowRuleDefinition)*
  3. shadowRuleDefinition ::=
  4. ruleName '(' storageUnitMapping shadowTableRule (',' shadowTableRule)* ')'
  5. storageUnitMapping ::=
  6. 'SOURCE' '=' storageUnitName ',' 'SHADOW' '=' storageUnitName
  7. shadowTableRule ::=
  8. tableName '(' shadowAlgorithm ')'
  9. shadowAlgorithm ::=
  10. 'TYPE' '(' 'NAME' '=' shadowAlgorithmType ',' propertiesDefinition ')'
  11. ruleName ::=
  12. identifier
  13. storageUnitName ::=
  14. identifier
  15. tableName ::=
  16. identifier
  17. algorithmName ::=
  18. identifier
  19. shadowAlgorithmType ::=
  20. string
  21. propertiesDefinition ::=
  22. 'PROPERTIES' '(' key '=' value (',' key '=' value)* ')'
  23. key ::=
  24. string
  25. value ::=
  26. literal

Supplement

  • storageUnitMapping specifies the mapping relationship between the source database and the shadow library. You need to use the storage unit managed by RDL, please refer to STORAGE UNIT;
  • 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 VALUE_MATCH, REGEX_MATCH and SQL_HINT.

Example

  • Create a shadow rule
  1. ALTER SHADOW RULE shadow_rule(
  2. SOURCE=demo_ds,
  3. SHADOW=demo_ds_shadow,
  4. t_order(TYPE(NAME="SQL_HINT")),
  5. t_order_item(TYPE(NAME="VALUE_MATCH", PROPERTIES("operation"="insert","column"="user_id", "value"='1')))
  6. );

Reserved word

ALTER, SHADOW, RULE, SOURCE, SHADOW, TYPE, NAME, PROPERTIES