This documentation supports the 21.3 (12.3) version of BMC Discovery.

Importing CSV data


It is often very easy to extract information from applications and devices and store it as CSV data. Data can be exported from BMC Discovery in this format. For more information, see CSV-API. You can also import CSV data into BMC Discovery (for example, you might have information about a number of hosts that you want to import).

You can import a CSV file using the Import CSV Data page described in the following section, and you can choose delimiters other than commas when using this page. Alternatively, if you have command line access, you can use the tw_imp_csv utility.

Incorrect usage may result in data loss
  • Using Import CSV Data incorrectly can cause irreparable damage to your data, because the data you submit using this page is applied directly to the production data without any validation. Before using the Import CSV Data page, ensure that you fully understand the system taxonomy and the changes that you plan to make to your data.
  • Always back up your datastore before using this tool.
Do not import the following node kinds
  • You must never import DDD nodes.
  • You should avoid importing Host nodes and other system maintained nodes. If in doubt, contact Customer Support.

The following topics are covered in this section:

To import a CSV file

  1. From the Model section, click CSV Import.
    The following screen illustrates the Import CSV Data page with the host container node kind selected.

    ImportCSVData.png
    The following table describes the options on this page:

  2. To import the CSV file, click Apply.

For examples of using the CSV importer, see CSV-import-examples.

File format

The CSV file represents a two-dimensional table with rows separated by newlines, and columns separated by commas. Commas can be included in that data but must be enclosed between double quote characters (").

Column names that do not begin with a hash character (#) are treated as names of attributes on the node.

Column names that begin with a hash character are treated as key expressions. Key expressions are used to create or update a relationship to another node. For more information, see Relationships.

Keys

The CSV importer searches the datastore for nodes of a specified kind that have a key or keys matching rows in the supplied CSV data. Where the keys match, the node is updated, or deleted and recreated, depending on the options selected. The first attribute column is used as a key by default. This can be overridden with the Keys option described in the preceding table.

Relationships

Relationship columns describe a relationship between the node being modified and one or more other nodes. Relationships are defined using a full key expression. The following example shows a link to a single node:

#role:relationship:role:kind.attribute

The following example shows a link to multiple target nodes. Notice that you must surround the relationship definition and data in double quotes so that the subsequent attributes are not treated as local nodes:

"#role:relationship:role:kind.attribute,attribute,attribute"

The first role part is the kind of the role that the node being created or updated plays in the relationship. The relationship part is the kind of the relationship being created. The second role part is the kind of role that the other node plays in the relationship. The kind part is the node kind of the other node. Finally, the attribute or attribute list is the name of the attribute used to find the other node. For information about relationships, see Node lifecycle.

Only a single traversal is supported.

Type conversion

By default, the CSV importer attempts to convert attribute values to the type defined in the taxonomy. If an attribute is not defined, it is left as a string. If a conversion fails, it is also left as a string.

For list types, the value in the CSV file must be in Python list syntax.

When the tw_imp_csv utility is used with the --force option, all attributes are left as strings.

You cannot import into dictionary type fields, such as the tag_set attribute on the VirtualMachine node. The import fails, and the following warning is displayed in the UI results page, or stdout for the tw_imp_csv utility:

csv_import WARNING tag_set is not being converted (CORBA.tk_alias) 

Related topics

 

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