Data loading and cleanup
Data loadingEach database table that needs to be loaded will have a CSV file in the Dataset directory. The CSV file name must be the same as the database table name. The first line of the CSV file is a listing
Data loading and cleanup
Data loadingEach database table that needs to be loaded will have a CSV file in the Dataset directory. The CSV file name must be the same as the database table name. The first line of the CSV file is a listing of the column names in the table. The remaining lines of the CSV file contain the data to be loaded into table. Each line of the file is one row of the table. The values in the data line must be in the same sequence as the column names in line 1. The figure below shows the contents of a file named **poldat.csv** that loads one row into the POLDAT table.
Figure: Example CSV file
Using Control FilesCycle includes a Step for loading data using control files (.ctl). This Step requires a MOCA connection and executes as an MLOAD would. The Step uses relative paths for the files.
I execute MOCA dataset "< DATASET_FILE_PATH >"using control file "< CONTROL_FILE_PATH >"
A dataset must contain one file named cleanup. When working with a MOCA connection the cleanup file will have a.msql extension. When working with a SQL connection the cleanup file will have a.sql extension. The cleanup.msql or cleanup.sql file contains the MOCA or SQL commands needed to perform the data cleanup. The cleanup file can run any type of command, but normally the commands are delete statements and update statements that undo the activities performed by the test. The figure below shows a MOCA-based cleanup file that removes the data added in the figure above.
Figure: Example cleanup file
Executing data loading and cleanup
Data loading and data cleanup activities are invoked by Steps within a Scenario. The Steps for loading data are shown below. These Steps first run the commands in the cleanup file and then load the CSV files.
I execute MOCA dataset "< PATH_TO_DATASET >" I execute SQL dataset "< PATH_TO_DATASET >"
When using these Steps, Cycle will look for any file name beginning with “cleanup” and ending with "sql" or "msql". If you want to validate a load, a validation script will run if you have a filename that begins with "validate" and ends with "sql" or "msql"; this also applies to "load...".
Files are run in this order (none are required):
- Then CSVs are imported into Cycle (inserted into database)
The specific Steps for performing data cleanup are shown below. These Steps only run the commands in the cleanup.msql or cleanup.sql file.
I execute cleanup script for MOCA dataset "< DATASET_DIRECTORY_PATH >" I execute cleanup script for SQL dataset "< DATASET_DIRECTORY_PATH >"