Lens provides CLI on a shell. This document provides various commands available in lens CLI. All the commands documented below can be seen by typing help from the CLI shell.
Opening the lens CLI shell is equivalent to open a session with lens server. This section provides all the commands available for in shell which are applicable for the full session.
Command | Description |
set name=value | Assign value to session parameter specified with name on lens server |
get name | Fetches and prints session parameter specified with name name from lens server |
show params | Fetches and prints all session parameter from lens server |
add jar path to jar file | Adds jar resource to the session |
add file path to file | Adds the file resource to the session |
remove jar path to file | removes jar resource from the session |
remove file path to file | remove the file resource from the session |
list resources [type] | list resources from the session for a given resource type. Lists all resources if resource type is not mentioned. type of resource can be either jar or file. help: type list resources -- for getting available options in the command |
close | Closes the session on the lens server and exits the shell. It is mandatory to call close to release all the resource of the session |
These commands provide CRUD for storages, cubes, facts, dimensions and partitions.
Command | Description |
show database | prints a list of databases on lens server |
use database-name | Sets the session database to database specified by database-name |
create database database-name | creates a database specified by database-name |
drop database database-name | drops the database specified by database-name |
Command | Description |
show storage | print all the storages present in the current database |
create storage storage-spec | Creates a new storage specified in storage-spec file |
update storage storage-table storage-spec | Updates storage storage-table as specified in the storage-spec file |
drop storage storage-table | drops storage table dimension-table |
describe storage storage-table | Prints the Schema and properties of Storage table storage-table |
Command | Description |
show cubes | Displays list of cubes |
create cube path to cube-spec.xml | Creates a cube specified in cube-spec.xml |
drop cube cube-name | Drops a cube specified by the name |
update cube cube-name cube-spec | updates the cube with cube-name to cube specification specified in cube-spec file |
describe cube cube-name | Print the schema of the cube |
Command | Description |
show dimensions | print all the dimension tables present in the current database |
create dimension dimension-spec storage-spec | Creates a new dimesion table with specification specified in dimension-spec file and storage specified in storage-spec file |
update dimension dimension-table dimension-spec | Updates dimension table dimension-table as specified in the dimension-spec file |
drop dimension dimension-table | drops dimension table dimension-table |
describe dimension dimension-table | Prints the Schema and property of Dimension table dimension-table |
dim list storage dimension-table | Prints list of storages associated to a particular dimension-table |
dim add storage dimension-table storage-spec | Adds a storage specified in storage-specfile to dimension-table |
dim drop storage dimension-table storage-name | Drops storage-name specified in dimension-table |
dim get storage dimension-table storage-name | Prints schema of the storage-name in dimension-table |
dim list partitions dimension-table storage-name | Prints list of partitions from storage-name in dimension-table |
dim drop partitions dimension-table storage-name | drops all partitions from storage-name in dimension-table |
dim add partition dimension-table storage-name part-spec | Add a partition specified in part-spec file to storage-name in dimension-table |
Command | Description |
show facts | print all the fact tables present in the current database |
create fact fact-spec storage-spec | Creates a new fact table with specification specified in fact-spec file and storage specified in storage-spec file |
update fact fact-table fact-spec | Updates fact table fact-table as specified in the fact-spec file |
drop fact fact-table | drops fact table fact-table |
describe fact fact-table | Prints the Schema and property of fact table fact-table |
fact list storage fact-table | Prints list of storages associated to a particular fact-table |
fact add storage fact-table storage-spec | Adds a storage specified in storage-specfile to fact-table |
fact drop storage fact-table storage-name | Drops storage-name specified in fact-table |
fact get storage fact-table storage-name | Prints schema of the storage-name in fact-table |
fact list partitions fact-table storage-name | Prints list of partitions from storage-name in fact-table |
fact drop partitions fact-table storage-name | drops all partitions from storage-name in fact-table |
fact add partition fact-table storage-name part-spec | Add a partition specified in part-spec file to storage-name in fact-table |
This section provides commands for query life cycle - submit, check status, fetch results, kill or list all the queries. Also provides commands for prepare a query, destroy a prepared query and list all prepared queries.
Please note that, character " is used as delimiter by the Spring Shell framework, which is used to build lens cli. So queries which require ", should be prefixed with another double quote. For example query execute cube select id,name from dim_table where name != ""first"", will be parsed as cube select id,name from dim_table where name != "first"
Command | Description |
query execute sql-text [async] | Executes Query specified in sql-text in synchronous manner unless async flag is passed. If async flag is passed then query handle is printed which can be used for query management |
query status query-handle | Prints the Status of query mentioned in Query Handle |
query explain sql-text | Prints query execution plan of sql-text |
query list | Prints list of queries |
query kill query-handle | Kill the execution of query specified by query-handle |
query results query-handle | Prints the result of Async query specified by query-handle |
prepQuery prepare sql-text | Prepares the query and gives a prepare handle |
prepQuery explain sql-text | Explains and Prepares the query. Prints the query and a prepare handle |
prepQuery list | Prints list of prepared queries |
prepQuery details prepare-handle | Prints details of the prepared query |
prepQuery execute prepare-handle [async] | Submits the prepared query for execution. If async flag is passed then query handle is printed which can be used for query management. Otherwise, results will be shown on the CLI |
prepQuery destroy prepare-handle | Destroys the prepared query |