Tools¶
AMI Center has several tools to help developers keep track of the various center objects such as tables, indexes triggers, etc.
These tools are actionable commands that can be run from the AMIDB Shell Tool. They are:
SHOW
: Returns information on a group of objects e.g.SHOW TABLES
DESCRIBE
: Returns the definition of a given objectDIAGNOSE
: Returns the memory usage of a given tableDISABLE
andENABLE
: Tools for turning timers & triggers on/offSETLOCAL
: Sets local variables for a given session, e.g: returned table limits
For a full breakdown of each center tool, see the list below.
SHOW
¶
Overview¶
Provides a table listing all records and relevant Metadata of a particular type with optional filtering and sorting.
The general format for a SHOW
query is as follows:
Expressions contained in square brackets ([]
) are optional. Script tool commands are case insensitive, however object names need to exactly match.
The full list of valid object_type
entries is listed in the table below.
Object Type | Additional Argument(s) | Description | Examples |
---|---|---|---|
TABLES |
FROM center_name |
|
SHOW TABLES , SHOW TABLES FROM my_center |
TABLE table_name |
FROM center_name |
|
SHOW TABLE accounts , SHOW TABLE accounts FROM my_center |
COLUMNS |
FROM center_name |
|
SHOW COLUMNS , SHOW COLUMNS FROM my_center |
COMMANDS |
|
SHOW COMMANDS |
|
CONNECTIONS |
|
SHOW CONNECTIONS |
|
DATASOURCES |
|
SHOW DATASOURCES |
|
DATASOURCE_TYPES |
|
SHOW DATASOURCES_TYPES |
|
DBO dbo_name |
FULL |
|
SHOW FULL DBO my_dbo , SHOW DBO my_dbo |
DBO_PLUGIN dbo_type |
|
SHOW DBO_PLUGIN simple_timer |
|
DBOS |
|
SHOW FULL DBOs |
|
INDEXES |
FROM center_name |
|
SHOW INDEXES , SHOW INDEXES FROM my_center |
METHODS |
|
SHOW METHODS |
|
METHOD method_name(method input) |
|
SHOW METHOD abs(Number) , SHOW METHOD binaryToStr(Binary) |
|
PLUGINS |
|
SHOW PLUGINS |
|
PLUGIN_OPTIONS |
|
SHOW PLUGIN_OPTIONS |
|
PROCEDURES |
|
SHOW PROCEDURES |
|
PROCESSES |
|
SHOW PROCESSES |
|
PROPERTIES |
|
SHOW PROPERTIES |
|
RELAYS |
|
SHOW RELAYS |
|
REPLICATIONS |
|
SHOW REPLICATIONS |
|
REPLICATION_SOURCES |
|
SHOW REPLICATION_SOURCES |
|
RESOURCES |
|
SHOW RESOURCES |
|
SESSIONS |
|
SHOW SESSIONS |
|
TIMERS |
FULL |
|
SHOW FULL TIMERS , SHOW TIMERS |
TRIGGERS |
FULL |
|
SHOW FULL TRIGGERS , SHOW TRIGGERS |
VARS |
|
SHOW VARS |
Note
For tables, only PUBLIC
tables are listed.
Examples¶
Example 1¶
-
This returns all tables whose name contains "data" and will order the results by the number of columns in the table:
Example 2¶
-
This returns all columns for the
myorders
table, alphabetized by name:
SHOW FULL
¶
Using the FULL
keyword will return the fully rendered text output of a given object's name instead of the first few characters.
This can be useful if you need the full text output, however it can result in text-wrapping in the console output which may be difficult to read.
While FULL
can apply to any center object, it is most relevant for the following:
- Timers
- Triggers
- DBO
Center Replication¶
You can also show tables from other connected centers (via center replication). To see what centers you have connected, in AMIDB run: SHOW CENTERS
. Then:
DESCRIBE
¶
Overview¶
Returns a table with a column titled "SQL" containing the AMI SQL statements necessary to reconstruct the supplied center object.
The full list of describable objects is listed here:
Example¶
-
This example will return the full AMI SQL
CREATE
statement that can be used to create the__CENTER
table and its primary key index.This returns the following AMI SQL:
Note
AMI system tables like __CENTER
and __COLUMN
have unique indexes associated to them. For more information on how indexes are implemented and used in AMI, see here.
Center Replication¶
You can also describe tables and other objects from other connected centers (via center replication).
On a given center, run the DESCRIBE
command:
This will return the AMI SQL query to create the replicated table in the current center.
DIAGNOSE
¶
Overview¶
Returns a table providing details on the approximate memory footprint of tables, columns and indexes.
Example¶
-
This example will return the memory used by the
__CENTER
table:The output will be a table similar to the following:
Table String TYPE String NAME String EST_MEMORY Long COUNT Integer CARDINALITY Integer COMMENT String __CENTER COLUMN CenterName 0 0 0 8-BYTE ADDRESSED JAVA OBJECT (String) __CENTER COLUMN Url 0 0 0 8-BYTE ADDRESSED JAVA OBJECT (String) __CENTER COLUMN CertFile 0 0 0 8-BYTE ADDRESSED JAVA OBJECT (String) __CENTER COLUMN Password 0 0 0 8-BYTE ADDRESSED JAVA OBJECT (String) __CENTER TABLE_OVERHEAD null 1048704 0 null COLUMNAR STORAGE ENGINE __CENTER INDEX pk 292 0 0 1 TREEMAP
DISABLE
and ENABLE
¶
Overview¶
Used to disable/enable triggers and timers by name. Disabled triggers and timers will not get executed when they otherwise would.
By default, when triggers and timers are created, they are enabled. Check the enabled/disabled status using SHOW TRIGGERS
and SHOW TIMERS
.
Example¶
-
This example will disable the trigger named
my_trigger
and enable the timermy_timer
:
SETLOCAL
¶
Overview¶
Controls local variables for the command line session. These local variables dictate behavior of the command line interface.
Run SETLOCAL
to see the list of variables that can be changed.
Note
This command cannot be run from the AMIDB Shell Tool.
Variables¶
Variables | Description |
---|---|
limit |
The default limit to apply to queries (similar to the limit field in the datamodel), -1 means no default limit |
max_print_chars |
Total number of characters to print to the console for a query result. This prevents from very large query results overwhelming terminal |
multiline |
If set to "off" then pressing enter will automatically execute the user entered. If set to "on" then pressing enter will progress to a new line for additional input. Pressing enter twice in succession will execute the users entered text. |
show_plan |
If set to "off" the engine will not show the query plan, this is more efficient as some overhead is necessary to gather and display this importation. If set to "on" then the engine will produce verbose output on the steps and time taking for each step in the query. This can be useful for optimizing your queries. |
timeout |
Amount of time in milliseconds that the console will hang waiting for a response. It must be a positive number |
unprintable_chars |
Determines how to print unprintable ASCII characters, for example 0x01 (SOH). If set to "marker" then an upside down question mark (¿) is printed in place of any unprintable chars (default). If set to "show" the raw, unprintable, is sent to stdout. If set to "hide" then nothing is printed. If set to "show_code" then an upside down question mark (¿) is printed followed by the chars 4 digit hexcode is printed. For example, the SOH would be printed as: ¿0001 |
datetime_format |
The format to use when printing UTC and UTCN columns. If set to empty string, the Raw long value (unix epoch) is printed. The default is "YYYY-MM-DD HH:mm:ss.SSS.z" |
timezone |
Works in conjunction with datetime_format, to determine local time for display. For example EST5EDT would be used for New York. Default is UTC |
string_template |
Should commands interpret string templates (default is off). If set to "on" then ${...} will be evaluated and replaced with the contents. If set to "off" then ${...} will be treated as a literal. |
password_encrypt |
If set to "on" then login command should be supplied with an encrypted password. The password will be decrypted using the key stored on the AMI server. Note, use strEncrypt(...) method to get the encrypted version of a plain text password. Ex: select strEncrypt("demopass"); . If set to "off" then login command should be supplied with plain text password. |
- Example