Row Level Delete Tasks

Row level delete tasks delete specific test cases, which consist of subsets of rows from related tables, from an existing environment that already contains data.

This allows you, for example, to remove a test case recently added to an environment without affecting data from other test cases.

Like row level processor copy tasks, a row level delete task relies on information in an application model to identify a start table and all tables that are related to it. You specify a start condition, and rows from all related tables are automatically identified. However, the rows that were identified as matching the start condition, as well as the rows from related tables, are not copied from one environment into another, but instead they are deleted without affecting unrelated rows. That is why a row level delete task only works in one environment and does not differentiate between a source and a target.

In this tutorial, we are going to create a row level delete task that deletes the department Research from the qa2 environment and removes all information about employees working in this department.

Creating the row level delete task

To create the delete task template:

  1. In the left sidebar, click the menu category Tasks to expand the tasks menu. Then click the menu item Task Templates.

  2. In the tab Row Level Processing, click the button Button with an arrow pointing to the right-hand direction on the left side of Row Level Delete Task Templates to expand the list. Initially, the list may be empty.

  3. Click the button + Create. A panel titled Create Row Level Delete Task Template opens. Enter the following information:

    Name

    Delete individual departments by name

  4. Click the button Create and edit.

  5. In the top panel, select the tab Custom Parameter. Click the button Configure Custom Parameters.

  6. In the dialog window Custom Parameter Activation, click the field Custom Parameter Definition section and select Department Name. (You may have to either scroll down the list of parameters or enter "Department Name" into the field filter to see the parameter.) Then click the button Apply.

  7. In the top panel, click the tab Start Conditions. Under Row Selection Mode, select Query.

    The field Start Condition already contains a blueprint for a SELECT query. We need to complete the query by adding a valid WHERE condition. Change the contents of the field so that it looks as follows:

    SELECT ${uniqueRowIdentifier}
    FROM "${startTableSchema}"."${startTableName}" "T"
    WHERE "T".dept_name = '${departmentName}'
  8. Click the button Save Changes.

Now that the task template has been created, we can define the actual task:

  1. In the bottom panel Tasks, select the tab Tasks and click the button + Create.

  2. Enter the following information:

    Department Name

    Research

    Environment

    Select Testing HR environment qa2 from the drop-down box

    Name

    Delete individual departments from qa2

  3. Click the button Create and edit.

  4. Optional: In the field Description in the tab Task Information, enter a description for the new task.

  5. Click the button Save Changes.

The first row level delete task is now defined. Like in row level processor tasks, in row level delete tasks you do not need to add mapping rules to specify the schema of the target tables. The schema name is taken from the specified target environment.

Executing the row level delete task

To execute your first row level delete task:

  1. In the left sidebar, click the menu category Tasks to expand the tasks menu and select the menu item Task Templates.

  2. In the tab Row Level Processing, click the button Button with an arrow pointing to the right-hand direction on the left side of Row Level Delete Task Templates to expand the list. Click the button Button with an arrow pointing to the right-hand direction next to Delete individual departments by name to expand the list of tasks. Locate the task Delete individual departments from qa2 in the panel Tasks in the tab Tasks and click the button Button with an arrow pointing to the right-hand direction displayed on the left of the task name.

  3. In the right sidebar, click the button Execute. A dialog window opens. Leave Interrupt execution unchecked and click the button Execute and view. This will schedule the task for immediate execution and switch the main view of Executed tasks.

  4. The task runs asynchronously in the background. Every five seconds, the status is refreshed automatically. Within a few minutes the task should finish.

  5. In the top left corner, the task status should show as COMPLETE.

You have now deleted the department (Research) with all its employees and all related information, including the job title history and salary history, from the qa2 schema.


Previous section: Data shop Next section: Stage Hooks