Create Task
To define the list of tables and validation rules, you need to create a comparison task. The task can be created from repcli or via REST API or Web UI.
To create a new validation task, via "repcli" use the "compare add" command.
CLI Syntax:
repcli compare add capture=id_of_the_capture_process tables=tables_specification deep=data_validation_percentage chunk=chunk_size excludecols=columns_to_ignore excludetype=data_type_to_ignore mapcols=custom_validation_criteria_for_column maptypes=custom_validation_criteria_for_datatypes where=filer_condition taskname=name_of_the_task
The input parameters are:
- capture - id of the capture process
- tables - criteria for the tables to be compared
- deep - The parameter is to specify data validation percentage. Possible values are 1-100. In order to exclude table from validation the "-1" value is used
- chunk - To compare data Repstance breaks down data into chunks and validate given percentage of data within a chunk. This parameter is to specify number of records to be processes in one chunk. Default value is 10000
- excludecols - comma separated list of the columns to be ignored during the validation
- excludetype - comma separated list of the data types to be ignored during the validation
- mapcols - Used to specify a user-defined function to transform a column value when comparing. The format is "SQL_FUNCTION(%COLUMN_NAME%)". The parameter can be provided multiple times
- maptypes - Used to specify a user-defined function to transform a column value of the given data type when comparing. The format is "SQL_FUNCTION(%DATA_TYPE%)". The parameter can be provided multiple times
- where - Used to specify additional "where" condition for the data to be compared
- taskname - Name of the task. If the parameter is not specified the task will be created with "default" name
- preview - When this parameter is enabled the details of the tables that are affected by the configuration will be provided but the task configuration will not be applied. Possible values are -
- 0 - do not enable preview mode
- 1 - enable preview mode
NOTE: if the “add” command if executed for the existing task it will overwrite the objects along with the validation rules
REST API:
- Endpoint: https://repstance_url/compare/add
- Method: POST
- Header:
- Content-Type: application/json
- X-Token: token
- Body:
{
"capture_id":id_of_the_capture_process,
"name":"name_of_the_task",
"data":[
{
"tables":"tables_specification",
"deep":data_validation_percentage,
"chunk":chunk_size,
"excludecols":"columns_to_ignore",
"excludetypes","data_type_to_ignore",
"mapcols":["custom_validation_criteria_for_column1", “custom_validation_criteria_for_column2”, …],
"maptypes":["custom_validation_criteria_for_datatype1", “custom_validation_criteria_for_datatype2”, …],
"keys":"table_key_columns"
}
],
"preview":true|false
}
Examples
The following example shows how to create the "TASK1" task for the capture=1 to compare 5% data for all tables in the dbo schema:
repcli compare add capture=1 taskname=TASK1 tables=dbo.% deep=5
The following command modifies the “TASK1” task to compare "employees" table without the "img" column:
repcli compare add capture=1 taskname=TASK1 tables=dbo.employees excludecols=img
To ignore any "TEXT" and "NTEXT" data types columns:
repcli compare add capture=1 taskname=TASK1 tables=dbo.% excludetypes=TEXT,NTEXT
Configure the EMP_NAME column to be compared in uppercase:
repcli compare add capture=1 taskname=TASK1 tables=dbo.% mapcols=upper(%EMP_NAME%)
Compare only first 100 characters for all columns of the "VARCHAR" type:
repcli compare add capture=1 taskname=DBO_TABLES tables=dbo.% maptypes=substr(%VARCHAR%,1,100)