workbench query command
You can run published queries and your own queries from the command line by using the istool workbench query command. You can view the results in a file that is in a comma-separated value (CSV) or a text format.
Purpose
Use this command to run queries or schedule queries to run. In the query command, the query name is searched for first in the published queries and then in the user queries. You cannot create, edit, or delete queries from the command line. By default, queries are run on assets in the catalog, but you can also run queries on assets in the development glossary.
Prerequisites
You must have any Information Governance Catalog role except the Information Governance Catalog Basic User role.
The version of istool command framework must be the same version as IBM® InfoSphere® Information Governance Catalog.
You must have Write and Create access to the directory and file for the query results.
You must allocate more memory to the istool process. For details, see this technote.
Run the command from the client tier, or from the engine tier if InfoSphere Information Governance Catalog was installed there.
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 to the command name.
Command syntax
workbench query
authentication parameters
[generic parameters]
-queryname query_name
-filename query_results_file
[-devglossary]
[-format file_format]
[-includeAssetID]
[-pagesize]
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, and to use a script to run commands.
- -queryname | -q query_name
- Specifies the name of the query to run.
- -filename | -f query_results_file
- Specifies the directory path and name of the file with the query results. A file extension is given, based on the value of the -format parameter.
- -devglossary | -devgl
- Specifies that the query is run on assets in the development glossary.
- -format | -fm file_format
- Specifies whether file_format is in a comma-separated value (CSV) format, a CSV file in UTF8 format (CSV_UTF8), or a Microsoft Office Excel spreadsheet (XLS) format.
- -includeAssetID | -id
- Includes the identification of the asset in the metadata repository to the query results.
- -pagesize | -ps
- When you execute a query, the query of the metadata repository can be performed in batches, with the query results stored in memory. Pagesize is the number of query result objects that are brought into memory in each batch. The larger the pagesize number, the quicker the query results are downloaded. However, the larger the pagesize number, the larger the amount of memory that is needed for the query process.
Output
A return value of 0 indicates successful completion. Any other value indicates failure. The reason for the failure is displayed in a screen message.
- For Microsoft Windows operating system environment
- C:\Documents and Settings\username\istool_workspace\.metadata\.log
- For UNIX or Linux® operating system environment
- user_home/username/istool_workspace/.metadata/.log
Example
workbench query
-q "My_DB_query"
-dom mysys
-f C:\IBM\InformationServer\queries\DB.csv
-u myid -p mypassword
Initializing query engine.... Executing query results 'My_DB_query' to file C:\IBM\InformationServer\queries\DB.csv Execution of query 'My_DB_query' complete