User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

How to Use Alter Hints

After the RDM Logical Model (tables and relationships between them) is defined, deployed, and filled with data, most changes to it require adding an additional configuration file alter-hints.xml to the configuration ZIP file before deploying changes to the model (see how-to-deploy-an-rdm-web-app-configuration.adoc).

Alter hints are necessary to preserve permissions and data on existing objects or pre-fill data on a new column that must not be empty.

Alter hints structure

The alter-hints.xml file has the following structure:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableB">
        <columns>
           <column targetName="columnB" expression="columnA" permissionsFrom="columnA"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>
Element Attribute Description

entity

sourceName

Old name of the table.

entity

targetName

New name of the table.

column

targetName

Name of the new column.

column

expression

Expression used to fill the data.

The syntax and available functions depend on the type of database used as the RDM repository. You can use any database native functions which do not violate generic SQL syntax, otherwise RDM throws an exception.

column

permissionsFrom

Name of the column from which to inherit viewing and editing rights.

The following sections present practical examples.

Add a new string column

The following example shows alter-hints.xml configuration for adding a new column of the string type, filling it with a constant value, and inheriting viewing and editing rights from a different column:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableA">
        <columns>
           <column
                   targetName="newStringColumn"
                   expression="'string enclosed in single quotes'"
                   permissionsFrom="anotherStringColumn"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>

Add a new integer column

The following example shows alter-hints.xml configuration for adding a new column of the integer-type domain, filling it with a constant value, and inheriting viewing and editing rights from a different column:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableA">
        <columns>
           <column
                   targetName="newIntegerColumn"
                   expression="0"
                   permissionsFrom="anotherIntegerColumn"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>

Add a new datetime column

The following example shows alter-hints.xml configuration for adding two new columns of the datetime-type domain, filling them with a constant value, and inheriting viewing and editing rights from a different column. This example can be used when transforming a table to using business dates (see Tables, section Business date columns).

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableA">
        <columns>
           <column
                   targetName="VERSION_FROM"
                   expression="to_date('2015-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')"
                   permissionsFrom="ID_tableA"
           />
           <column
                   targetName="VERSION_TO"
                   expression="to_date('2015-12-31 00:00:00', 'YYYY-MM-DD HH24:MI:SS')"
                   permissionsFrom="ID_tableA"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>

Change column data type

The following example shows alter-hints.xml configuration for changing a column data type from integer to string. In reality, a new column is created in the RDM repository; therefore, viewing and editing rights are configured to be inherited too:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableA">
        <columns>
           <column
                   targetName="columnA"
                   expression="to_char(columnA)"
                   permissionsFrom="columnA"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>

Renaming a column

The following example shows alter-hints.xml configuration for renaming a column. In reality, a new column is created in the RDM repository; therefore, viewing and editing rights are configured to be inherited too:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableA">
        <columns>
           <column
                   targetName="NewColumnA"
                   expression="OldColumnA"
                   permissionsFrom="OldColumnA"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>

Renaming the foreign key column

Renaming a foreign key column is necessary when changing the relationship name between tables: child tables contain foreign key columns to parent tables and are named using the following naming convention: [prefix]_[relationship_name], where prefix is set to GENERATEDPK.

The following example shows alter-hints.xml configuration for renaming a foreign key column:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableA">
        <columns>
           <column
                   targetName="GENERATEDPK_NewRelationshipName"
                   expression="GENERATEDPK_OldRelationshipName"
           />
        </columns>
     </entity>
   </entities>
</alter-hints>

Rename a table

The following example shows alter-hints.xml configuration for renaming a table. A new table is created in the database, therefore all table columns inherit their own data and permissions automatically. For this reason, you should not define the columns element:

<alter-hints>
   <entities>
     <entity sourceName="tableA" targetName="tableB">
     </entity>
   </entities>
</alter-hints>

Was this page useful?