REWRITE ADD Command | unityadmin | Teradata Unity - 17.00 - REWRITE ADD - Continuous Availability - Teradata Unity

Teradata® Unity™ User Guide

Product
Continuous Availability
Teradata Unity
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2020-09-15
dita:mapPath
fmz1594836948704.ditamap
dita:ditavalPath
qqk1595871525984.ditaval

Purpose

Adds query rewrite patterns.

Syntax

REWRITE ADD id input regexp output regexp ;

Parameters

id
A unique string to identify the specific Rewrite Rule.
input regexp
The Tool Command Language (TCL) regular expression that enables matching SQL from a client.
To make sure that only the SQL required is matched, make the input regexp pattern be as specific as possible. Include a ^ at the beginning and a $ at the end of each pattern.
output regexp
The SQL regular expression that Unity generates and sends to Teradata.

Example

The following rewrite pattern forces all selected files on table myDb.myTable that does not have a where clause to use ACCESS locks.

unityadmin>  REWRITE ADD forceAccessOnMyTable "^SELECT(.*)FROM myDb.myTable$" "LOCKING TABLE myDb.myTable FOR ACCESS SELECT \1 FROM myDb.myTable"; 
Rewrite rule add request completed successfully