Deploying and ignoring selective records while using CDT
The data is imported completely when you use CDT to import data from source to target databases. You can use Ignore and AppendOnly modes to import the data according to your business needs. When you ignore certain tables, the ignored tables are not imported during the deployment.
If you need to import the tables but ignore certain environment-specific records, such as
PLT_PROPERTY
or YFS_COMMON_CODE
, you can ignore those specific
values during the import by using the RecordFilter mode. The ignored values are not overridden in
the target database.
Process
CDT reads or stores ydkprefs.xml
for its configurations and preferences.
For performing selective record deployment, a RecordFilter mode is set under
SourceTargetPrefs
to define data preferences for deployment from specific tables.
CDT evaluates the RecordFilter element and removes the records from source that matches the
criteria. However, it does not apply the same RecordFilter on target to avoid analysis of records
that do not exist in source after RecordFilter is applied. Instead, it picks only those records that
were picked from the source with RecordFilter. RecordFilter process occurs before transformation to
ensure transformation is applied only on selected records.
<RecordFilter>
<Table Name="PLT_PROPERTY">
<Column Name="PROPERTY_NAME" NotValue="sc.file.upload.maxfilesize"/>
</Table>
</RecordFilter>
The example shows that the sc.file.upload.maxfilesize
property records are ignored from source data while exporting and are not overridden in the target
data while importing data by using CDT.RecordFilter preferences
- Define tables under the RecordFilter tag to select the data.
- Define elements under the tables that are defined in the RecordFilter.
Table 1. Table elements Element Description And If you want to add multiple columns for a table, you can use the And element and then add the column elements with attributes. For list of attributes, see Table 2. Or If you want to add multiple columns for a table, you can use the Or element and then add the column elements with attributes. For list of attributes, see Table 2. Column Select the Column element from the table with its attribute values. For list of attributes, see Table 2. Note: Combination ofAnd
andOr
is not supported. - Provide columns with the name and an expression for selecting the records.
- Expressions are supported by several attributes. Use the following table for the supported
attributes and the SQL equivalent.
Table 2. Column attributes Attribute Description SQL equivalent Value ="data" A column must be equal to the data to select a record. = 'data'
Not Value ="data" A column must not be equal to the data to select a record. != 'data'
Match ="data" A column must contain the data as substring to select a record. LIKE '%DATA%'
NotMatch ="data" A column must not contain the data as substring to select a record. NOT LIKE '%DATA%'
Values ="data1,data2,data3" A column must have one of the data that is mentioned to select a record. Avoid spaces between data. IN (data1, data2, data3)
NotValues ="data1,data2,data3" A column must not have any of the data that is mentioned to select a record. Avoid spaces between data. NOT IN (data1, data2, data3)
IsNull ="Y/N" A column can be null if IsNull is Y and not null if IsNull is N to select a record. IS NULL
orIS NOT NULL
- Two optional attributes are provided with
Values
orNotValues
.- Delimiter: If data contains comma, you can use this attribute to define the delimiter.
- IncludeNull: You can include null value in addition to all the values.
- If the table tag contains multiple columns, columns can be grouped with
And
orOr
. The combination ofAnd
andOr
is not supported. - Table element can contain
Column
,And
, orOr
single child elements.
RecordFilter sample structure in ydkprefs.xml
<SourceTargetPrefs>
<SourceTargetPair SourceDatabase="XXX" TargetDatabase="YYYY">
<Transformations>
.....................
</Transformations>
<RecordFilter>
<Table Name="TABLE1">
<Column Name="COLUMN1" Value="Some Value"/>
</Table>
<Table Name="TABLE2">
<Or>
<Column Name="COLUMN1" Value="Some Value"/>
<Column Name="COLUMN2" NotValue="Some Value"/>
<Column Name="COLUMN3" Match="Some Expression" />
<Column Name="COLUMN4" Values="value1,value2,value3" IncludeNull="Y"/>
<Column Name="COLUMN5" IsNull="Y/N" />
</Or>
</Table>
<Table Name="TABLE3">
<And>
<Column Name="COLUMN1" Value="Some Value"/>
<Column Name="COLUMN2" Match="Some Expression"
<Column Name="COLUMN3" NotMatch="Some Expression" />
<Column Name="COLUMN4" NotValues="value1,value2,value3"/>
<Column Name="COLUMN5" Values="val,ue1;value2;val,ue3" Delimeter=";" />
</And>
</Table>
</RecordFilter>
<Ignore>
........................
</Ignore>
<AppendOnly>
........................
</AppendOnly>
</SourceTargetPair>
</SourceTargetPrefs>