The CREATE SHADOW RULE
syntax is used to create a shadow rule.
CreateShadowRule ::=
'CREATE' 'SHADOW' 'RULE' ifNotExists? shadowRuleDefinition (',' shadowRuleDefinition)*
ifNotExists ::=
'IF' 'NOT' 'EXISTS'
shadowRuleDefinition ::=
ruleName '(' storageUnitMapping shadowTableRule (',' shadowTableRule)* ')'
storageUnitMapping ::=
'SOURCE' '=' storageUnitName ',' 'SHADOW' '=' storageUnitName
shadowTableRule ::=
tableName '(' shadowAlgorithm ')'
shadowAlgorithm ::=
'TYPE' '(' 'NAME' '=' shadowAlgorithmType ',' propertiesDefinition ')'
ruleName ::=
identifier
storageUnitName ::=
identifier
tableName ::=
identifier
algorithmName ::=
identifier
shadowAlgorithmType ::=
string
propertiesDefinition ::=
'PROPERTIES' '(' key '=' value (',' key '=' value)* ')'
key ::=
string
value ::=
literal
ruleName
cannot be created;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;algorithmName
is not specified, it will be automatically generated according to ruleName
, tableName
and shadowAlgorithmType
;shadowAlgorithmType
currently supports VALUE_MATCH
, REGEX_MATCH
and SIMPLE_HINT
;ifNotExists
caluse is used for avoid Duplicate shadow rule
error.CREATE SHADOW RULE shadow_rule(
SOURCE=demo_ds,
SHADOW=demo_ds_shadow,
t_order(TYPE(NAME="SIMPLE_HINT", PROPERTIES("shadow"="true", "foo"="bar"))),
t_order_item(TYPE(NAME="VALUE_MATCH", PROPERTIES("operation"="insert","column"="user_id", "value"='1')))
);
ifNotExists
clauseCREATE SHADOW RULE IF NOT EXISTS shadow_rule(
SOURCE=demo_ds,
SHADOW=demo_ds_shadow,
t_order(TYPE(NAME="SIMPLE_HINT", PROPERTIES("shadow"="true", "foo"="bar"))),
t_order_item(TYPE(NAME="VALUE_MATCH", PROPERTIES("operation"="insert","column"="user_id", "value"='1')))
);
CREATE
, SHADOW
, RULE
, SOURCE
, SHADOW
, TYPE
, NAME
, PROPERTIES