4. Manage Application Components¶
Make sure that the application exists: Add an Application.
4.1. Add Database Objects to the Application¶
API_REDADM.ADD_APP_DISCOVER_RULE adds database objects to an application by search rules (discover rules):
The patterns are regular expressions; ‘^’ and ‘$’ are added implicitly.
Include patterns for schema and table are mandatory, exclude patterns are optional.
The application name and the BDomain are mandatory, the rule comment is optional.
The following example adds the objects named ‘TEST_TAB’ in all schemas containing ‘TEST’, except schemas ending with ‘_RAW’, for the BDomain ‘TESTING’.
Example: Add a Discover Rule
1EXECUTE SCRIPT API_REDADM.ADD_APP_DISCOVER_RULE(
2 'TEST_APP' -- p_app_name
3 ,'.*_TEST_.*' -- p_schema_incl_pattern
4 ,'.*_RAW' -- p_schema_excl_pattern
5 ,'TEST_TAB' -- p_table_incl_pattern
6 ,null -- p_table_excl_pattern
7 ,'TESTING' -- p_bdomain
8 ,'Adding objects to the test application' -- p_rule_comment
9);
The rule is stored in REDADM.RED_APP_DISCOVER_RULES with a generated rule ID:
RULE_ID |
APP_NAME |
SCHEMA_INCL_PATTERN |
SCHEMA_EXCL_PATTERN |
TABLE_INCL_PATTERN |
TABLE_EXCL_PATTERN |
BDOMAIN |
RULE_COMMENT |
|---|---|---|---|---|---|---|---|
3 |
TEST_APP |
.TEST. |
.*_RAW |
TEST_TAB |
(null) |
TESTING |
Adding objects to the test application |
The resulting components are materialised in REDADM.RED_APP_COMPONENTS by API_REDADM.REFRESH_APP_COMPONENTS, which is also part of API_REDADM.REFRESH. Run it after changing discover rules and check the components:
Example: Refresh and Check the Components
1EXECUTE SCRIPT API_REDADM.REFRESH_APP_COMPONENTS();
2
3SELECT * FROM REDADM.RED_APP_COMPONENTS WHERE APP_NAME = 'TEST_APP';
4.2. Modify a Discover Rule¶
To modify a discover rule, use API_REDADM.MODIFY_APP_DISCOVER_RULE with the rule ID from REDADM.RED_APP_DISCOVER_RULES.
NULL leaves a parameter unchanged, while a blank (’ ‘) restores its default value.
In the following example only the schema exclude pattern and the rule comment are changed.
Example: Change the Exclude Pattern
1EXECUTE SCRIPT API_REDADM.MODIFY_APP_DISCOVER_RULE(
2 3 -- p_rule_id
3 ,'TEST_APP' -- p_app_name
4 ,null -- p_schema_incl_pattern
5 ,'.*_(RAW|BA)' -- p_schema_excl_pattern
6 ,null -- p_table_incl_pattern
7 ,null -- p_table_excl_pattern
8 ,null -- p_bdomain
9 ,'modifying discover rule' -- p_rule_comment
10);
The rule in REDADM.RED_APP_DISCOVER_RULES has changed:
RULE_ID |
APP_NAME |
SCHEMA_INCL_PATTERN |
SCHEMA_EXCL_PATTERN |
TABLE_INCL_PATTERN |
TABLE_EXCL_PATTERN |
BDOMAIN |
RULE_COMMENT |
|---|---|---|---|---|---|---|---|
3 |
TEST_APP |
.TEST. |
.*_(RAW|BA) |
TEST_TAB |
(null) |
TESTING |
modifying discover rule |
4.3. Remove a Discover Rule¶
When a discover rule is removed with API_REDADM.REMOVE_APP_DISCOVER_RULE, the objects it found are no longer components of the application (after the next component refresh).
Example: Remove the Rule 3
1EXECUTE SCRIPT API_REDADM.REMOVE_APP_DISCOVER_RULE(
2 3 -- p_rule_id
3);
The rule is removed from REDADM.RED_APP_DISCOVER_RULES.