Commands List

Documentation for all the available CLI/REPL/Server actions

Actions

addConnection (connection)

add a new connection

Arguments

  • name (string) - the name of the new connection, optional
  • type (string) - the type of the connection, optional
  • connectionString (string) - the connection string, optional
  • description (string) - the connetion description, optional

Usage

Start an add-connection prompt
Javascript
addConnection()
Shell
metis add-connection
Add a connection with name, type, connection-string and description
Javascript
addConnection("localPostgresDB", "postgres", "postgresql://user:[email protected]:5432/dbname", "Dev Postgres connection")
Shell
metis add-connection "localPostgresDB" "postgres" "postgresql://user:[email protected]:5432/dbname" "Dev Postgres connection"
Javascript
addConnection("mysqlLocalCon", "mysql", "mysql://root:[email protected]:3306/database_name", "Dev Mysql connection")
Shell
metis add-connection "mysqlLocalCon" "mysql" "mysql://root:[email protected]:3306/database_name" "Dev Mysql connection"

connect (connection)

The 'connect' action connects to a given connection by name. If the connection exists, the tables, and their additional information would be pulled from the database. The connection is not actually kept open. A connection will be made whenever a request to the database is made.

Arguments

  • connectionName (string) - the name of the connection, required

Usage

Javascript
connect("connection-name")
Shell
metis --connect "connection-name"

deleteConnection (connection)

remove a given connection from file

Arguments

  • connectionName (string) - the name of the connection, required

Usage

Javascript
deleteConnection("connection-name")
Shell
metis delete-connection "connection-name"

editConnection (connection)

edit a connection

Arguments

  • connectionName (string) - the name of the connection, required

Options

  • name (string) - the name of the updated connection
  • type (string) - the type of the updated connection
  • username (string) - the user name for the updated connection
  • password (string) - the password for the updated connection
  • host (string) - the host for the updated connection
  • port (number) - the port for the updated connection
  • description (string) - the updated connetion description

listConnections (connection)

show the existing connections

setDefaultConnection (connection)

set the default connection and connects to it

Arguments

  • connectionName (string) - the name of the connection, required

Usage

Javascript
setDefaultConnection("connection-name")
Shell
metis set-default-connection "connection-name"

testConnection (connection)

test the given connection

Arguments

  • connectionName (string) - the name of the connection, required

updateConnectionName (connection)

Change the name of a given connection

Arguments

  • connectionName (string) - the name of the connection, required
  • newConnectionName (string) - the new name for the connection, required

Usage

Javascript
updateConnectionName("old-connection-name", "new-connection-name")
Shell
metis update-connection-name "old-connection-name" "new-connection-name"

descMetric (describe)

describe a given metric

Arguments

  • metric (string) - name of the metric, required

descRule (describe)

describe a rule by given id

Arguments

  • id (string) - the id of the rule, required
  • facts (object) - an object containing facts, optional

Usage

Javascript
descRule("QRY000001")
Shell
metis desc-rule "QRY000001"
Javascript
descRule("QRY000001", { 'actual-rows-read': 1000000 })
Shell
metis desc-rule "QRY000001" '{"actual-rows-read":1000000}'

descTable (describe)

describes a given table

Arguments

  • twoPartName (string) - name of the database and table connected with a dot, required

Usage

Javascript
descTable("schema.table-name")
Shell
metis desc-table "schema.table-name"

listTables (describe)

print the tables list for the current connection

tableAnalysisReport (describe)

print a report of available facts

getPlan (query-analysis)

get an execution plan for a given query

Arguments

  • query (string) - query to analyze , required

listFunctions (query-analysis)

Show the User Defined Functions (UDF) in the DB

queryAnalysis (query-analysis)

The 'queryAnalysisPG' action runs an analysis on a given query. The output can be controlled using option parameters.

Arguments

  • query (string) - query to analyze, required

Options

  • showFormattedSql (boolean) - show formatted SQL, default: true
  • showPlan (boolean) - show simplified execution plan
  • showExplain (boolean) - show explain information
  • showMetrics (boolean) - show the facts gathered from the execution plan, default: true
  • showTableInfo (boolean) - show table info, default: true
  • showTableIndexInfo (boolean) - show table index/es info
  • showInsights (boolean) - show insights information, default: true
  • routeName (string) - route name, default: "metis/cli/queryAnalysis"
  • tag (string) - tag name, default: "PR"
  • showAllInsights (boolean) - show all the insight include skipped, success, low, very low and info, default: true
  • execPlanType (enum) - run execution plan with chosen mode actual/estimated, default: "Estimated", values: ["Actual", "Estimated"]
  • showMetricsDiff (boolean) - show the diff between all the existing metrics to the generated metrics

Usage

Javascript
queryAnalysis("SELECT * FROM TableName")
Shell
metis query-analysis "SELECT * FROM TableName"
Javascript
queryAnalysis("SELECT * FROM TableName").showPlan(true)
Shell
metis query-analysis "SELECT * FROM TableName" --show-plan

sqlCmd (query-analysis)

execute an SQL command

Arguments

  • sqlQuery (string) - regular SQL query, required

Usage

Javascript
sqlCmd("SELECT * FROM table").
Shell
metis sql-cmd "SELECT * FROM table"

complete (repl)

exits the REPL

Arguments

  • args (array) - the cli input, default: [], optional

config (repl)

prints the current configuration

doc (repl)

prints the description of an action

Arguments

  • actionName (string) - the name of the action to print, required

editConfig (repl)

edit/add key and value to config

Arguments

  • key (string) - key name, required
  • value (any) - the value, can be of any type, required

exit (repl)

exits the REPL

Arguments

  • exitCode (number) - the exit code that would be used when terminating the process, optional

generateBashCompletions (repl)

generate a completion file for bash

Arguments

  • file (string) - the file out path, required

help (repl)

prints the description of all available functions

Options

  • category (string) - select category to show
  • search (string) - fuzzy search phrase

noProgress (repl)

disable printing of progress bars

printMode (repl)

set the print mode

Arguments

  • mode (string) - the mode, one of: [pretty, json, silent], default: "pretty", required

setApiKey (repl)

add metis api key

Arguments

  • apiKey (string) - the metis api key value, required

welcome (repl)

prints the welcome message

withProgress (repl)

enables printing of progress bars

indexAnalysis (static-analysis)

run static analysis on table

Arguments

  • indexName (string) - index name, required

Options

  • showQueries (boolean) - show sql queries
  • severity (enum) - severity of rules to show, default: "low", values: ["critical", "high", "medium", "low", "info"]

tableAnalysis (static-analysis)

run static analysis on table

Arguments

  • tableName (string) - table name, required

Options

  • showQueries (boolean) - show sql queries
  • severity (enum) - severity of rules to show, default: "low", values: ["critical", "high", "medium", "low", "info"]