lv-client

LiveView Client — the LiveView command-line client

SYNOPSIS

lv-client [-u uri][-c][-w waitTimeMS] "command" [help]

lv-client --version

lv-client help

LV> command;

DESCRIPTION

lv-client is the command-line client for creating simple queries against a running LiveView Server. You can use some lv-client commands in scripts or directly from a system command-line. Commands that are supported for use at the command line are noted with (command-line support).

All commands in the interactive client must end with a semicolon (;).

OPTIONS

-u uri

Specify the uri for the LiveView Server instance. If a URI is provided, lv-client connects to this server immediately upon starting up, or quits if unsuccessful.

-c

Return query output as comma-separated value (CSV) format.

-w waitTimeMS

Specifies a wait time waitTimeMS in milliseconds for the command to continually attempt to connect to LiveView Server before abandoning the connect attempt.

--version

Shows the installed version of the LiveViewClient library.

COMMANDS

addalertaction ruleID

Adds an alert action to the ruleID provided. The available actions are:

  • delete

  • publish

  • email

addalertrule tableName predicate --message "messageText" --name "alertName"

Adds an alert rule with no actions.

close queryid

Close a specified query.

connect [uri]

Close any existing connection and connect to a LiveView Server instance. The connect command with no arguments will connect to the default LiveView Server uri, lv://localhost:10080.

connstat

Retrieve information about the current LiveView Server connection (command-line support).

delete

Delete rows that match a query predicate. Deleted data cannot be recovered, so use this command with care.

disablerules [ruleid]

Disables all or specified alert rules. To specify a rule, use the rule id number (command-line support).

enablerules [ruleid]

Enables all or specified alert rules. To specify a rule, use the rule id number (command-line support).

help

Display available commands (command-line support). The --help option also provides command-level help for every option of the command argument.

listen queryid

Listen to a running live query. Press x+enter to stop listening.

listrules [ruleid]

Lists all or specified alert rules. To specify a rule, use the rule id number (command-line support).

listtables [TableName]

List tables available for querying. If you give the command a table name as a argument, it will return the field names and associated data types of the specified table (command-line support).

live

Create a live query (command-line support).

livestat

List status of current live queries.

print queryid

Print current results of a live query.

publish datafile.csv TableName

Publish data from a CSV file to a specified table (command-line support).

quit

Quit interactive client.

select

Run a snapshot query. The select command uses the syntax of the SQL SELECT statement (command-line support).

shutdown

Shutdown LiveView Server (command-line support).

version

Displays version of the connected LiveView Server (command-line support).

EXAMPLES

This example runs simple queries against the sample project sample_lv-helloliveview.

  1. To run the sample_lv-helloliveview, follow these steps:

    1. Open a StreamBase Command Prompt from StartAll ProgramsStreamBase n.m menu.

    2. For the Windows username sbuser, launch LiveView Server running the sample_lv-helloliveview as follows. (This single command is shown on two lines for clarity.)

      lv-server run "C:\Users\sbuser\Documents\
        StreamBase Studio 7.2 Workspace\sample_lv-helloliveview"
      
  2. Use the command line to list the tables in sample_lv-helloliveview:

    lv-client listtables
    
  3. Start the interactive prompt and connect to the default uri. By default, lv-client with no arguments will connect to this uri.

    lv-client -u lv://localhost:10080
    
  4. Create a snapshot query that returns all rows from the ItemsSales table where lastSoldPrice is greater than 10 and quantityRemaining is less than 20:

    SELECT * FROM ItemsSales WHERE lastSoldPrice > 10 AND quantityRemaining < 20;
    
  5. Exit the interactive client and run the same query from the system command line:

    quit;
    lv-client -u lv://localhost:10080 "SELECT * FROM ItemsSales WHERE lastSoldPrice > 10 AND quantityRemaining < 20;"
    

This example DOS script starts the project sample_lv-helloliveview, waits 3 minutes for LiveView Server to be up, and then checks the connection status.

start /min lv-server run "C:\Users\sbuser\Documents\
  StreamBase Studio 7.4 Workspace\sample_lv-helloliveview"
lv-client -w 180000 connstat