Replace Tables
The REPLACE_TABLES
Pre-hook can rewrite the submitted query, replacing the tables which are referenced in the query with different tables which are specified in the hook definition.
{
'Tables':
[{
'From': <from>,
'To': <to>
}]
}
<from>
- The table name to replace
<to>
- The table name to replace with
- If none of the from table name(s) match any tables, the hook has no impact on the query.
CREATE SUNDECK FLOW REPLACE_PROD_WITH_TEST
PRE HOOK REPLACE
ALWAYS
REPLACE_TABLES
{ 'Tables': [
{'From': 'PROD.S.CUSTOMERS', 'To': 'TEST.S.MY_CUSTOMERS'}
]
}
;
This will replace all references to the PROD.S.CUSTOMERS table with the TEST.S.MY_CUSTOMERS table