Query command for common metadata assets

Use the istool query command with the -cm, -lm, or -dca parameters to list common metadata assets that are stored in the metadata repository.

Purpose

You can use the query command to get the repository ID and identity string of one or more assets. You can write the results to a file.

The following types of common metadata assets can be queried on the command line.
Table 1. Supported common metadata asset types and their command-line query parameters
Asset type Query parameter

Business intelligence assets
Data connections
Implemented data resources
MDM models
Physical data models

-cm
Logical data models -lm
Data class and data collection analysis assets -dca

If you want to delete the queried assets, you can use the output file as input to the deletecm command.

When you have many assets in the repository, it might be more efficient to do successive queries. For example, you could first run a query to find all the schemas in the repository, and then run a second query on only those schemas that have database tables that you want to delete.

Prerequisites

You must have the Suite User role.

The preferred way to run this command is in the istool command-line window. If you run this command in your operating system command-line window or in scripts, you must add istool before the command name.

Command syntax

Optional parameters and values in the syntax are enclosed in brackets, [ ].

The symbols &| used together indicate and/or.

query 
authentication parameters
[generic parameters]
[-outputfile ["file_name_and_path"]]
-commonmetadata '[-base "base_identity_string"] asset1 [asset2 asset3 ...]' &|
-logicalmetadata '[-base "base_identity_string"] asset1 [asset2 asset3 ...]' &|
-dataclassanalysis '[-base "base_identity_string"] asset1 [asset2 asset3 ...]'  

Parameters

authentication parameters
Required. All asset interchange commands use authentication parameters to connect to a specific installation of InfoSphere® Information Server.
generic parameters
The generic parameters are available to all asset interchange commands. Use the generic parameters to request help on command syntax, to specify silent or verbose operation, or to use a script to run commands.
-outputfile | -of ["file_name_and_path"]
Specifies that the query results are written to a file. Each type of metadata that you specify in the command is written to a separate file, with an identifying suffix. For example, if you export all three types of metadata with the same command, and specify inventory.txt as the output file name, the files are named inventory_commonmetadata.txt, inventory_logicalmetadata.txt, and inventory_dataclassanalysis.txt. If you do not specify a file name and path, the results are written to a file named query_output_metadata_type.txt in the current directory; for example, query_output_logicalmetadata.txt. The results include the repository ID (RID) of each asset and the identity string of each asset.

The output file is not created if the file path contains a period (.) in addition to the period before the file extension.

If the query result contains an asset that does not have required attributes in the identity string, such as database name, Invalid Identity is written to the output in place of the identity string.

-commonmetadata | -cm '' &| -logicalmetadata | -lm '' &| -dataclassanalysis | -dca ''
Required. You must use one or more of the parameters to specify types of common metadata assets to query. Use the -lm parameter to specify logical model assets, the -dca parameter to specify data class and data collection analysis assets, and the -cm parameter to specify all other supported common metadata asset types.
Specify the identity strings of one or more assets within the single quotation marks that follow each asset-type parameter. Use a single space to separate each asset that you specify. The format of the identity strings is described in Common metadata asset types and identity strings for the command line. You can use wildcards to specify multiple assets. The query command fails if you specify more than four tilde (˜) characters in an identity string.
Important: If you create an output file to use as input to the deletecm command, do not combine any of the following types of assets, which use the -cm parameter, in the same file:
  • BI assets
  • Implemented data resources
  • Physical data model assets
You can use the following option:
-base "beginning_section_of_identity_string"
Specifies the beginning section of an identity string that applies to all the assets that you specify for each asset type that you specify. The -base option can be used as a shortcut when each asset is contained in the same identity hierarchy. Surround the value with double quotation marks ("). Specify the remainder of each identity string separately for each asset, separating each with a single space.
Do not specify the final forward slash (/) in the value of the -base option, and do not add that forward slash to the beginning of the values of the remainders of the identity string.
For example, to query all database tables in three schemas of the same database, you specify the -cm parameter, followed by -base "/host1/database1". For each schema you specify the schema name followed by an asterisk and the table extension (*.tbl) to indicate all tables. For example:
 -cm -base "/host1/database1" schema1/*.tbl schema2/*.tbl schema3/*.tbl

Example

The following command writes the identity string and repository ID of the database db1 to the file c:\to_delete_commonmetadata.txt.
query –dom ABC:9443 –u xmetauser –p xmetapwd 
-outputfile "c:\to_delete.txt"
 –commonmetadata '/host1/db1.db'
The following command writes a list of BI reports whose names begin with "rep" to the file.
query –dom ABC:9443 –u xmetauser –p xmetapwd 
-of "c:\to_delete.txt"
 –cm '/bi_server1/bi_folder1/rep*.rdf'
The following command selects the tables that begin with "table" in schema1, and writes them to the file query_output_commonmetadata.txt.
query –dom ABC:9443 –u xmetauser –p xmetapwd 
–commonmetadata '/host1/db/schema1/table*.tbl'
The following command queries which hosts, databases, and database schemas the specified repository contains, and writes the result to the file query_results_commonmetadata.txt.
query –dom ABC:9443 –u xmetauser –p xmetapwd 
-cm '/*.hst  /*/*.db  /*/*/*.sch' -of "C:\query_results.txt"
The following command uses the -base option to write the details of all the tables that belong to schema1 and schema2 in database db1 to the file.
query –dom ABC:9443 –u xmetauser –p xmetapwd
-cm '-base "/hostname/db1" schema1/*.tbl schema2/*.tbl' 
-of "C:\query_results.txt"
The following command writes all data class and data collection analysis assets to the file dc_dataclassanalysis.txt.
query -domain ABC:9443 -username isadmin -password isadmin 
-outputfile c:\dc.txt -dca '/*/*.dc /*.als'
The following command writes the following assets to files:
  • All database schemas in the metadata repository to the file all_commonmetadata.txt
  • All logical models to the file all_logicalmetadata.txt
  • All data classes in Namespace1, and all data collection analysis assets in the InfoSphere Information Analyzer project Analyses1, to the file all_dataclassanalysis.txt
query -domain ABC:9443 -username isadmin -password isadmin 
-outputfile c:\all.txt -cm '/*/*/*.sch' -lm '/*/*.lm' 
-dca '/Namespace1/*.dc /Analyses1.als'