Skip to main content
Delphix

Masking Inventory Import and Export (KBA1815)

 

 

KBA

KBA#1815

 

This document describes the Inventory Export and Import process. Masked columns can be changed in multiple environments, Rule Sets, and Tables using the CSV import process.

Applicable Delphix Versions

Click here to view the versions of the Delphix engine to which this article applies
Date Release
Apr 17, 2024 | May 8, 2024 22.0.0.0 | 22.0.0.1
Mar 20, 2024 | Apr 2, 2024 21.0.0.0 | 21.0.0.1
Feb 21, 2024 20.0.0.0
Jan 25, 2024 19.0.0.0
Dec 20, 2023 | Jan 10, 2024 18.0.0.0 | 18.0.0.1
Nov 21, 2023 17.0.0.0
Oct 18, 2023 16.0.0.0
Sep 21, 2023 15.0.0.0
Aug 24, 2023 14.0.0.0
Jul 24, 2023 13.0.0.0
Jun 21, 2023 12.0.0.0
May 25, 2023 11.0.0.0
Apr 13, 2023 10.0.0.0 | 10.0.0.1
Mar 13, 2023 | Mar 20, 2023 9.0.0.0 | 9.0.0.1
Feb 13, 2023 8.0.0.0
Jan 12, 2023 7.0.0.0
Releases Prior to 2023
Major Release All Sub Releases
6.0

6.0.7.0, 6.0.8.0, 6.0.8.1, 6.0.9.0, 6.0.10.0, 6.0.10.1, 6.0.11.0, 6.0.12.0, 6.0.12.1, 6.0.13.0, 6.0.13.1, 6.0.14.0, 6.0.15.0, 6.0.16.0, 6.0.17.0, 6.0.17.1, 6.0.17.2

At a Glance 

Description This KBA describes the Export and Import CSV process to configure and modify the Masking Inventory.
Location UI Before ver 18: Environments > [Environment] > Inventory 
Ver 18 onwards: Environments > [Environment] > Rule Set > [Rule Set] > Actions 
API Ver 14 onwards
  • POST /file-rulesets/{fileRulesetId}/csvExport
  • PUT /file-rulesets/{fileRulesetId}/csvImport
  • POST /database-rulesets/{databaseRulesetId}/csvExport
  • PUT /database-rulesets/{databaseRulesetId}/csvImport
Data Exported All properties in the selected Rule Set are Exported
Data Imported
Required to: Required fields: 
Define Object These fields define which Inventory object to change: 
  • Environment Name
  • Rule Set
  • Table Name
  • Column Name
Apply Change These fields define what property in the Inventory to change: 
  • Domain, Algorithm, Is Masked (all three needed)
  • ID Method*
  • Row Type
  • Date Format
     
  • Notes
  • Multi-Column Logical Field
  • Group Number
     
  • Document Store Type*
  • File Format*
  • SQL Type Code*

* Can only be changed on some connector types.

CSV Entries Only properties that need to be modified need to be included in the imported CSV. All other entries (rows) in the CSV can be removed.
 

The CSV entries (rows) are needed: 

  • To toggle if a column is masked or not; and
  • To set algorithms; and
  • To change any field properties.
Limitation The values in the Inventory CSV file are not enclosed with quotes. This means that any entry with a comma will corrupt the CSV file. 

Two workarounds might resolve or limit the impact of this limitation: 
  1. Remove CSV entries (rows) that contain commas. Update these manually in the UI or use the API.
  2. Ensure names and comments are without commas.
Popups Note:
  • Browser Popups need to be enabled for import to succeed. 
Updates The CSV Format was updated in the following versions:
  • In version 6.0.9.0, the following fields were added:
    • Notes
    • Multi-Column Logical Field
    • Group Number
       
  • In version 6.0.17.0, the following fields were added:
    • Document Store Type
    • File Format
       
  • In version 10.0.0.0, the following field was added:
    • SQL Type Code
More info For troubleshooting help:

Details about Multi Column algorithm Framework:


Masking Documentation:

 

CSV File Format 

The file format for the exported and imported CSV file is detailed below. Additional columns are not allowed. 

Database

Export Description

Only the selected Rule Set will be exported. CSV format as of 10.0.0.0.

-----------------------------+------------+-------------------------------------------------------------
 CSV Field                   | Value      |  Export comment                                                 
-----------------------------+------------+-------------------------------------------------------------
 Environment Name            | As in UI   | Only the selected Environment
 Rule Set                    | As in UI   | Only the selected Rule Set
-----------------------------+------------+-------------------------------------------------------------
 Table Name                  | As in UI   | All tables in the Rule Set
 Type                        | -          | Normally not used - default '-'
 Parent Column Name          | -          | Normally not used - default '-'
 Column Name                 | As in UI   | All columns in the Rule Set
 Data Type                   | As in UI   | The Data Type for specified column
 Domain                      | As in UI   | The assigned Domain for specified column
 Algorithm                   | As in UI   | The assigned algorithm for specified column
 Document Store Type      ** | As in UI   | If used, example of values are XML or JSON
 File Format              ** | As in UI   | If used, the name of the File Format
 Is Masked                   | TRUE/FALSE | TRUE = specified column is masked. FALSE= Not Masked
 ID Method                   | Auto/User  | User = Domain/Algorithm is locked. Auto = profiler can change
 Row Type                    | 'All Row'  | Normally not used - default 'All Row'
 Date Format                 | As in UI   | The assigned Date Format for specified column
 Notes*                      | As in UI   | To record notes
 Multi-Column Logical Field* | As in UI   | Used with Multi-Column algorithm
 Group Number              * | As in UI   | Used with Multi-Column algorithm
 SQL Type Code           *** | Info only  | A numeric code indicating SQL Type (used with Doc Store) 
-----------------------------+------------+-------------------------------------------------------------
Note 1 ---------------------------------------------------------------------------------
 * From version 6.0.9.0   ** From version 6.0.17.0    *** From version 10.0.0.0
----------------------------------------------------------------------------------------

Import Description

CSV format as of 10.0.0.0.

-----------------------------+------------+----------+----------------------------------
 CSV Field                   | Value      | Import   | Import comment
-----------------------------+------------+----------+----------------------------------
 Environment Name            | As in UI   | Req      | Need to match existing
 Rule Set                    | As in UI   | Req      | Need to match existing
 Table Name                  | As in UI   | Req/Mult | Need to match existing
 Type                        | -          | -        | Normally not used
 Parent Column Name          | -          | -        | Normally not used
 Column Name                 | As in UI   | Req/Mult | Need to match existing
-----------------------------+------------+----------+----------------------------------
 Data Type                   | -          | -        | Information Only
-----------------------------+------------+----------+----------------------------------
 Domain                      | As in UI   | Optional | Mutual Dependency #1
 Algorithm                   | As in UI   | Optional | Mutual Dependency #1
 Document Store Type      ** | As in UI   | Optional | Set by import
 File Format              ** | As in UI   | Optional | Set by import
 Is Masked                   | TRUE/FALSE | Optional | Mutual Dependency #1
-----------------------------+------------+----------+----------------------------------
 ID Method                   | Auto/User  | Optional | Set by import
 Row Type                    | 'All Row'  | Optional | Set by import
 Date Format                 | As in UI   | Optional | Set by import
 Notes*                      | As in UI   | Optional | Set by import
 Multi-Column Logical Field* | As in UI   | Optional | Set by import
 Group Number*               | As in UI   | Optional | Set by import
-----------------------------+------------+----------+----------------------------------
 SQL Type Code           *** | -          | -        | Information Only
-----------------------------+------------+----------+----------------------------------
Note 1 ---------------------------------------------------------------------------------
 #1  Mutual Dependency - All 3 fields must be specified when any of them are set.

Note 2 ---------------------------------------------------------------------------------
 * From version 6.0.9.0   ** From version 6.0.17.0    *** From version 10.0.0.0

Note 3 ---------------------------------------------------------------------------------
 "Req"      - Filed is required
 "Mult"     - Multiple objects can be updated with one CSV file
 "Optional" - Only rows that modify the Inventory are needed. All other can be excluded
----------------------------------------------------------------------------------------

 

Example

The example below includes the Header and one column.

Example as of version 10.

Environment Name,Rule Set,Table Name,Type,Parent Column Name,Column Name,Data Type,Domain,Algorithm,Document Store Type,File Format,Is Masked,ID Method,Row Type,Date Format,Notes,Multi-Column Logical Field,Group Number,SQL Type Code
MyEnv,MyRS,MyTable,-,-,id,int (10),-,-,-,-,FALSE,Auto,All Row,-,-,-,-,4
MyEnv,MyRS,MyTable,-,-,XML_Data,xml,-,-,XML,sample_file_2fields.xml,TRUE,User,All Row,-,-,-,-,-16

Troubleshooting

Import does not start  

Before version 14, the import process requires Browser Popups to be enabled.

Look for Browser notifications. 

Resolution  

Navigate to the browser settings and enable popups for the masking engine page. 

Performance

The Inventory Export and Import can take a long time depending on the size of the inventory involved. It can take many minutes to process millions of columns in an inventory (this is a very large Rule Set). 

In both export and import scenarios, you have to wait for the popup which shows the process to be complete. The Export/Import will terminate if the browser is closed or the session expires.

A message in the popup will indicate when the process is finished or if there is an error.  

Reducing import time 

The time can be improved by removing CSV entries that have not changed (usually these are fields not masked).

If the Rule Set has 100,000 columns and only 1,000 are masked - importing only 1,000 vs 100,000 will reduce the import time by a factor of 100. This will see the import taking seconds rather than minutes.

Comma in Fields

If there is a comma in a field value then the CSV has an invalid format. The Inventory CSV is a standard CSV and values are not enclosed (quoted). As such values cannot have a comma in them.

This issue has been fixed 6.0.10.0 - tracked under DLPX-74740 (and DLPX-57674). 

Notes still have an issue tracked in DLPX-89824.

File Format Pattern or File

If the File Format Pattern or File has a comma, this can be worked around by creating (or editing) a Pattern without a comma, then Export and Import the Rule Set. The Rule Set can then be edited to include the comma.

tip

Tip:

This works because the Inventory is assigned to the File Format (and not each individual file or pattern).

 

Remove rows with commas

Remove the row (or rows) with a comma from the CSV file and Import the file.  

This usually has no impact on the Inventory as only changes are needed in the CSV. If needed, manually change the Inventory. 

Specified object is not valid 

If a referenced object (such as a Table, Column, Domain, or Algorithm) is not available on the Masking Engine, a warning is shown in the popup. 

Warnings are:

  • "Specified Environment name [name] is not valid"
  • "Specified Ruleset name [name] is not valid"
  • "Specified Table name [name] is not valid"
  • "Specified Column name [name] is not valid"
  • "Specified domain [name] is not valid"
  • "Specified Algorithm [name] is not valid"
  • "Specified Date Format [format] is not valid"
  • "Unmatched Inventory not updated into Application"

Any object with this warning was not applied and updated in the Inventory. Please verify the name and if the object exists in the Rule Set and try again.

Note

Notes:

  1. Correct spelling and case are required to reference objects.
  2. The reference to algorithms is the Algorithm Name as shown in the UI.

Examples of these warnings can be seen below:

Import Inventory CSV Warnings - example.png

Masking Logs 

Errors in the import process are logged in the masking info log (some warnings are not logged).

Below are some examples related to the warning shown in the popup above.

Reading each line of the csv imported Inventory: Environment,RS,table_1,-,-,Col_1,varchar (20),FIRST_NAME,LAST NAME SL,true,Auto,All Row,-
Environment Environment does not exist

Reading each line of the csv imported Inventory: Env,RuleSet,table_1,-,-,Col_1,varchar (20),FIRST_NAME,LAST NAME SL,true,Auto,All Row,-
Rule Set RuleSet does not exist

Reading each line of the csv imported Inventory: Env,RS,table_1,-,-,Column,varchar (20),FIRST_NAME,LAST NAME SL,true,Auto,All Row,-
Env Env, Rule Set RS_BUG : Column Column does not exist

Reading each line of the csv imported Inventory: Env,RS,table_1,-,-,Col,varchar (20),FIRST_NAME,LAST NAME SL,true,Auto,All Row,XXXX@MM!dd
Input date format:XXXX@MM!dd Valid:false

Resolution 

Depending on what object is throwing the warning, please check the object on the Masking Engine UI and correct the reference to the object, the spelling, the case, or the date format. 

To get an example of the CSV file, please export a file from the UI.

Incorrect number of columns in CSV 

If the CSV file is missing a comma or column(s), the following error will be thrown in the UI "Error occurred during importing inventory. ..."


Import Inventory CSV Error.png

Checking the masking logs provides more information:

Proceeding to reading and checking that csv has proper formatting
...
Reading each line of the csv imported Inventory: Environment,RuleSet,Table,-,-,Column,NUMBER (0),-,-
Exception :
java.lang.RuntimeException: Unexpected number of fields on line 19 of imported Inventory: expected 13, found 9
...

Resolution 

Check the masking logs, the row, and the error. The error shows how many columns are expected and the failed row is shown above. 

From the example above:

Error: 
  * Unexpected number of fields
  * on line 19 
  * expected 13, found 9
  
Row:
  * Is      : "Environment,RuleSet,Table,-,-,Column,NUMBER (0),-,-"
  * Expected: "Environment,RuleSet,Table,-,-,Column,NUMBER (0),-,-,true,Auto,All Row,-"
    

Invalid File Format 

If the header is missing or has incorrect fields, the following error is shown: "Invalid File Format". The popup will look like this:

Import Inventory CSV Invalid File Format.png

The logs will not show any imported rows (and no error message):

User has requested to import a csv file to Inventory
csv file upload successful to path: /var/delphix/dmsuite/import/delphix_admin/ImportInventory
...
If there is no error and inventory does not get updated, make sure popup is enabled.

Resolution  

The best way to resolve this issue is to export a Rule Set (Inventory), copy the header from this file, and then paste it into the failed import file.

Invalid characters in the CSV file 

The characters need to match the objects in the Rule Set and algorithm names. Invalid characters in the CSV file can and is likely to cause undesired behaviors which are not easy to detect.

Example of issues:

  • Trailing and leading spaces.
  • Incorrect end-of-line character(s).
  • Invalid character in the row with data.
  • A column name that includes a comma (any column names that include a comma will need to have their algorithm set manually in the GUI)

Resolution 

The best resolution here is to be diligent in editing the CSV file. Open it in a text editor, save it to a standard ANSII character set and check for invalid characters.