ipisql command-line options
- Last UpdatedJan 13, 2023
- 2 minute read
- PI System
- PI Server
The ipisql utility supports several options that you can specify at a command prompt.
Most of the options are the same as the command-line options for PI SQL Subsystem (the pisqlss executable), specifically timeout (-t), time step (-ts), and options (-o). See pisqlss command-line options.
|
ipisql option |
Description |
|
-csv |
Write results to standard output in comma-separated variable format suitable for importing into a spreadsheet. The query text, column headings, row count and error information are written to standard error, also in comma-separated variable format. No command prompts are displayed. |
|
-f |
Identifies a query file. If this argument is used, the ipisql command executes the query in the specified file and exits. A command prompt is not displayed. |
|
-node |
Identifies the Data Archive node to connect to. The name to use is the Data Archive computer's network name. If the Data Archive node uses a port number other than 5450, specify the port number using suffix port_number to this name (for example, -node mynode:545), or specify -port port_number (for example, -node mynode -port 545). |
|
-o |
Specify the options in a comma-separated list of tokens with no space between tokens. The interpretation of the tokens is not case-sensitive. The supported options are AGGRTIMESTART, EXECSAFE, QEP, SUBSET, and ANSISQLVAL. When you set -o to ANSISQLVAL, ipisql returns the values for integer points in the column. If you do not set this option, ipisql returns the values for integer points in the column. |
|
-p0...-pn |
SQL parameter values. The first parameter is -p0 (zero), the second is -p1, and so on. You can specify as many SQL parameters as you like, and need not specify all of them; ipisql prompts for any additional parameter values needed. The SQL parameter values are in effect throughout the entire ipisql session. |
|
-password |
Password. This argument is interpreted only if the username argument is supplied. If -username is provided, but -password is not, ipisql prompts you for a password. |
|
-port |
TCP/IP port number. This argument is interpreted only if the -node argument is supplied. For Windows, the default value is 5450. You can add :portnum to the end of the node name when providing the node argument. |
|
-t |
SQL query timeout, in seconds. If this time expires, the query returns a timeout error or a subset of the actual results, depending on the SUBSET option in effect for pisqlss. |
|
-ts |
Default value of the timestep column in the piinterp table. This value can be overridden for any query by specifying a timestep constraint in your SELECT statement. |
|
-username |
User name. If this argument is not present, the ipisql command does not attempt to validate your identity; default access rights apply. |
Examples
To execute a query in the file myquery.txt against the Data Archive server named larry with port number using a default timestep of two minutes, type:
ipisql -ts 120 -f myquery.txt -node larry:5450
If the file myquery.txt contains the statement:
select * from picomp where tag = ? and time >= ?
To avoid the prompt for SQL parameter values, type:
ipisql -f myquery.txt -p0 sinusoid -p1 "today"