Related Extract with Disguise SQLServer


BMC AMI Test Drive 
e Test Data Privacy – Related Extract with Disguise SQL Server

This tutorial will introduce you to the BMC AMI DevX Data Studio Related Extract to create a relationally intact subset of data while using Disguise Rules to change and protect sensitive data.

Revised: 2024/03/14 00:00 



Getting Started

Instructions:

  • This guide contains many screenshots to provide a visual reference
  • Please note each place that you must enter your own specific ID or number
  • You must complete each step before proceeding to the next to successfully follow the test drive script

The BMC AMI DevX Test Drive Experience requires that the user must have completed the Building Your Environment exercise before starting any tutorial script.
 If, at any point during your experience, your host connection times out, you may need to log back in to the TestDrive host connection.

image-2023-4-10_9-28-3.png

If at any time during the execution of this script the Common Enterprise Services Login popup is shown, enter your test drive ID and password under User ID and Password, check the Save credentials box and then depress the ENTER key or click OK.


BMC AMI DevX Data Studio

BMC AMI DevX Data Studio simplifies the complex task of managing and preparing data for testing. This enables developers and test engineers to perform data-related tasks without writing programs or scripts, coding SQL, or using multiple utilities.
 They can easily create specifications to extract related sets of data from one environment and load them into another. Extracting just the relevant data needed for testing is done using easy-to-use selection criteria or starting key values. The extracted data will remain relationally intact based on the referential integrity (RI) or application relationships (AR). Data Privacy rules can be applied at the time of extract to protect sensitive data. Data can then be loaded into the environment of choice by supplying the necessary target information in a Related Load job.
 In this exercise you will:

  • Create a Related Extract specification
    • Extract all related data using Referential Integrity
    • Create Application Relationships
    • Create Selection Criteria to extract only specific data
    • Disguise Data during Extract

Create a Related Extract Specification


Do This
  • Open the DevX Data Studio perspective in Workbench for Eclipse

image-2024-3-14_11-24-54.png

Do This
  • Select the Data Explorer tab in the top left.

image-2023-4-4_13-27-24.png


Do This
  • Double click the FAEXRepos Repository in the Data Explorer tab on the left pane or right-click and select Open.

image-2023-4-4_13-30-19.png


Do This
  • Right-click on Related Extract within the Data Explorer and select New.

image-2023-4-4_13-31-5.png

In this example you will extract data from multiple SQL Server tables. Note that you can use this same process against DB2, DB2 z/OS, Oracle, and Sybase.

Do This
  • Name the related extract job SQL_SERVER_EXTRACT.
  • Click the Browse button beside Driving Object to select a table as a starting point within the database.

image-2023-4-4_13-32-14.png


Do This
  • For Type leave the selection of Database (JDBC). 
  • Select SQL Server Sample from the Host drop down menu.
  • Type dbo (in lowercase) for the schema Name. 
  • Click List. 
  • Enter "testdrive for the userid and password if prompted for credentials.
  • Select the ORDER_TABLE and Click OK.

image-2023-4-4_13-34-17.png

This will populate the Driving Object field and show the Host connection.


Do This
  • Click Finish.

image-2023-4-4_13-35-12.png


Do This
  • Check the box Use referential integrity and Click the Discover Relationships button below it.
  • Click the Browse button to navigate to a file location to extract the data.

image-2023-4-4_13-36-40.png


Do This
  • Click on Temporary Files.
  • Click the Select Folder button.

image-2023-4-4_13-37-44.png


Do This

You are now at the Extract Overview Screen with navigation tabs along the bottom.

  • Click the Objects tab at the bottom of this section.

image-2023-4-4_13-38-50.png


Do This

You now see all tables related to the ORDER_TABLE through referential integrity and will be included in the extract.


  • Select the Order_Table row. 
  • Right click to see the Selection Criteria menu.

For that table you can apply selection criteria, determine process type, and see properties.


  • Click the Relationships tab at the bottom of the screen.

image-2023-4-4_13-43-4.png

This view shows the objects as parents and dependents and the type of relationship. In this example all objects are related through RI (referential integrity). Application Relationships would have AR in that column.


Do This
  • Click the Visualization tab at the bottom of this section.

image-2023-4-4_13-44-14.png

The Visualization view shows the objects graphically. Solid lines indicate the tables are related through RI (referential integrity) which is maintained in the database.

Do This
  • Right click on any table and select properties to view for that object.  Properties will appear in a tab below.
  • Click the Data Privacy tab at the bottom of this section.

image-2023-4-4_13-45-30.png


Do This
  • Click the Browse button beside Project Name.

image-2023-4-4_13-47-53.png


Do This
  • Select the TDPRepos repository from the drop down.
  • Highlight your project and click OK. 
  • If you do not see your project select TEST DRIVE DISGUISE PROJECT.

image-2023-4-4_13-48-59.png


Do This
  • Click the Keys tab at the bottom of this section.

image-2023-4-4_13-50-10.png

Extracts may be driven by a key file to subset the data and get precise information.

Key files may also be created from an extract to drive another extract, possibly in a different database.


Do This
  • Click the Options tab at the bottom of this section.

image-2023-4-4_13-51-19.png

Extract Options include limits, discovery options, and more advance database options.


Do This
  • To execute this Related Extract click the Blue Arrow Execute button in the top right.

image-2023-4-4_13-52-31.png 

 

Processing details will show up in the Console tab. You may double click this tab to maximize the view.

The report shows the number of rows extracted from each table and the data privacy applied to each eligible column. It shows for each table which columns had a disguise rule applied and how many rows were changed. Scroll through to understand how the rules were applied according to the Source Data Identifiers in the Project.

Do This
  • Double click this tab to maximize the view.
  • Scroll through the report.

image-2023-4-4_13-55-45.png


Do This
  • Double click on the Console tab to minimize this view.
  • Close Related Extract job by clicking on the X in the tab. 
  • Save your changes.

image-2023-4-4_13-57-1.png

You have now successfully created a Related Extract job and extracted rows from multiple tables related through Referential Integrity and applied disguise rules to replace sensitive data in columns containing Names, Phone Numbers, Social Security Numbers, Credit Card Numbers, Dates, and Email addresses.


Application Relationships

Application Relationships are used to relate objects when there is no RI maintained within the database or between certain tables. This allows the Related Extract to extract only related rows from these tables in the same manner as it would with RI. These Application Relationships are maintained within the product and make no changes to the database.  


Do This
  • In the Data Explorer tab right click on Application Relationship and select New.

image-2023-4-4_16-28-14.png

In this example, the Order table is programmatically related to the Customer table but there is no RI in the database. 


Do This
  • Type CUSTORD in the name field. 
  • Give it a description for future reference. 
  • Click Add Objects to select these two tables.

image-2023-4-4_16-29-33.png


Do This
  • Type dbo (in lowercase) for the Schema name.
  • Click List.
  • Select the CUSTOMER_TABLE and click Add.

image-2023-4-4_16-30-33.png


Do This
  • Highlight the ORDER_TABLE.
  • Click Add and Close

image-2023-4-4_16-31-17.png


Do This
  • Click Finish.

image-2023-4-4_16-32-49.png


Do This
  • Click on the Objects tab along the bottom.

image-2023-4-4_16-33-48.png


Do This
  • Highlight the first table in the list.
  • Use the middle icon top right to Create New Relationship.

image-2023-4-4_16-34-43.png


Do This
  • Type CUSTORD in the Relationship Name field.
  • Use the drop down to select the ORDER_TABLE as the dependent on the right.

image-2023-4-4_16-35-49.png

To create the Application Relationship we will relate the Customer Number column in the Customer table to the Cust Num column in the Order table. 

Do This
  • Click on Customer Number on the left under Customer Table.
  • Click on Cust Num on the right under Order Table.
  • Click on the Add Association icon to create relationship.

image-2023-4-4_16-36-53.png


Do This
  • Verify that the columns are now listed under Associations at the bottom.
  • Click Create and Close.

image-2023-4-4_16-41-33.png

Note: Multiple tables can be related through AR. If there were more tables selected, the Create button would allow additional relationships to be created. Also, tables can be related through more than one column.


Do This
  • Click on the Relationships tab along the bottom to see the newly created Relationship.

image-2023-4-4_16-42-38.png


Do This
  • Click on the Visualization tab. 

This shows a graphical representation of the objects and the relationships.

image-2023-4-4_16-43-44.png


Do This
  • Click the X in the tab at the top to close the newly created Application Relationship. 
  • Click save.

image-2023-4-4_16-44-23.png

This Application Relationship can now be incorporated into a Related Extract job. This type of relationship will be treated in the same manner as an RI relationship during the extract process. The parent row extracted will pass along the key to the dependent table based on the column used to relate the tables and any rows there that match will also be extracted.

Selection Criteria

Selection Criteria allows specific data to be extracted based on data values. In this example all rows from the Order table where the Order Type is equal to Purchase will be selected. Then during the extract all related rows will be extracted from the other tables.

Do This
  • In the Data Explorer tab right click on Selection Criteria and select New.

image-2023-4-4_16-46-33.png

Give the Selection Criteria a meaningful name to make it reusable. 


Do This
  • Type "Purchases" in the name field.
  • Click Browse to select a table.

image-2023-4-5_10-29-10.png

Do This
  • Type dbo (in lowercase) for the Schema name. 
  • Click List.
  • Select the ORDER_TABLE and click OK.

image-2023-4-5_10-30-26.png


Do This
  • Click Finish.

image-2023-4-5_10-31-1.png


Do This
  • Click the Conditions tab along the bottom of this section.

image-2023-4-5_10-31-55.png


Do This
  • Click on the Add a new condition icon on the top right.

image-2023-4-5_10-32-50.png


Do This
  • Click on the <Select field> under the Field Name column.

image-2023-4-5_10-33-49.png


Do This
  • Use the drop-down menu and select the ORD_TYPE column.

image-2023-4-5_10-35-0.png


Do This
  • Click in the space under Condition Type to activate the drop-down menu. 
  • Select Equal to from the list.

image-2023-4-5_10-36-0.png


Do This
  • Click in the space under the Value column and select the box with "…".

image2021-12-21_18-17-5.png


Do This
  • Type PURCHASE for our selection value.
  • Click OK.

image-2023-4-5_10-37-44.png


Do This

The selection criteria is now complete.  You can see the SQL where clause below.

  • Click the X in the tab to close the Selection Criteria.

image2021-12-21_18-18-53.png


Do This
  • Click Save to save the Selection Criteria.

image-2023-4-5_10-39-4.png


Execute Extract with AR and Selection Criteria

For this exercise we will open the Related Extract job created earlier. This time we will be adding in additional tables through the use of Application Relationships. We will also be limiting the number of rows extracted by using Selection Criteria.


Do This
  • In the Data Explorer tab, right click the existing SQL_SERVER_EXTRACT job and select Open.  Expand Related Extract if not already open.

image-2023-4-5_10-41-56.png


Do This
  • Check the box to Use application relationships.
  • Click on the Select Relationship button.

image-2023-4-5_10-42-47.png



Do This
  • Select the CUSTORD relationship previously created and click OK.

image-2023-4-5_10-43-31.png


Do This
  • Click the Discover Relationships button.

 

This will refresh the RI relationships and will now include the additional AR relationships.

image-2023-4-5_10-44-13.png


Do This
  • Click the Objects tab along the bottom to see all objects now included in the Extract.

image-2023-4-5_10-45-54.png

Note you now see the Customer table because of the AR created to the Order table. There is also an additional table, Contact table.


Do This
  • Click on the Relationships tab along the bottom.

image-2023-4-5_10-46-55.png

Note the Customer table is related to the Order table with a Relationship Type of AR. Once the Customer table is related, it will include in the extract the Contact table since they are related through RI.


Do This
  • Click again on the Objects tab.
  • Select the Order table and right click.
  • Hover over Selection Criteria and choose Select.

image-2023-4-5_10-48-17.png

For that table you can apply selection criteria, determine process type, and see properties. This can be activated and applied to any table, not just the driving table for more complex criteria to get just the data needed.


Do This
  • Select the Selection Criteria previously created and click OK.

image-2023-4-5_10-49-23.png


Do This
  • Click on the blue arrow icon top right to execute.

image-2023-4-5_10-50-22.png

This will extract all rows from the Order table where Order Type is equal to Purchase. Then it will extract the related rows of data from the other tables related through Referential Integrity, including the Customer table now related through an Application Relationship. Since we had previously selected a Data Privacy Project any sensitive data will also be disguised.

Do This

Double click the Console tab to maximize.

image-2023-4-5_10-54-3.png

Check the Rows Extracted numbers. We are now only selecting 18 rows from the Order table instead of the 42 from the previous execution with no selection criteria.

Do This
  • Double click the Console tab to minimize.
  • Click on the X in the tab to close the Related Extract job.
  • You may save your changes.


You have now successfully extracted related data using Referential Integrity and Application Relationships while applying Selection Criteria to subset that data based on specific data values and Disguised the data so that it is now compliant with existing privacy regulations.  This data is now ready to be loaded into a testing or development environment.

This completes the Related Extract with Disguise section.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*