Version:

Query

Click Query in the top navigation menu to access several data management tools.

SQL Tool

The SQL Tool allows you to perform SQL queries against the data in Kinetica from Kinetica Administration Application (GAdmin). The SQL Tool works similarly to the SQL Lab in Reveal but has fewer restrictions. To read more about using the SQL Tool from the command line (also known as KiSQL), review Kinetica SQL (KiSQL).

Several actions are available from this tool:

  • Increase or decrease the # of lines to increase or decrease the size of the SQL Statements box.
  • Select Halt on Error to halt SQL query execution if an error occurs. This is particularly useful when executing several statements in sequence as this will break on the first error in that sequence
  • Click Clear History to remove all previously executed queries from the list.
  • You can view and page through your query history using the < Prev and Next > buttons, or view & select (for re-execution) from the entire history using the Queries button in between them.
  • After entering one or more semicolon-terminated queries and/or DML/DDL commands into the SQL Statements area, click Run to execute.
  • Click Clear SQL to clear both the SQL Statements & Query Result areas.
  • Select a portion of the text entered into SQL Statements and click Run Highlighted to execute only the selected portion.
../_images/query_kisql.png

SQL snippets and autocomplete are also available to help expedite writing queries.

../_images/query_kisql_autocomplete.png

API Tool

The API Tool allows you to call any Kinetica REST endpoint with a given set of parameters.

Request Mode allows the choice of two methods for passing parameters in endpoint calls:

  • Builder - assign values to named parameters individually
  • JSON - pass the request as a single block of JSON text

The result of the request is output to the Logs panel. Click Clear at the bottom to clear the output.

The History tab lists previously executed commands and their results. Click Reload to load the selected endpoint and associated parameters into the Builder for subsequent re-execution. Click Clear Saved Queries in the top right-hand corner to delete the query history.

Clicking the API Docs button will print the corresponding documentation entry for the endpoint in the Logs panel to the right.

../_images/query_advanced.png

Builder

The Builder mode of the API Tool displays a user entry control for each of the selected endpoint's parameters. Each control will show the parameter name & type and the option to enter the parameter as Text or to use a parameter from the previous request's Response or Request object. The last set of parameters used in an endpoint call will be saved until the next time the endpoint is queried.

Each request will log the request parameters in JSON format at the top of the Logs panel to the right. This request block can then be fed back into the API Tool in JSON mode, which may facilitate repeated querying, as the entire request can be seen and modified at one time.

Here is an example of a request to the /aggregate/groupby endpoint in Builder mode:

../_images/query_advanced_builder.png

JSON

The JSON mode of the API Tool provides a user entry control to enter the request parameters as a single block of JSON. The last JSON request will be saved until the next time the endpoint is queried.

Here is an example of a request to the /aggregate/groupby endpoint in JSON mode:

../_images/query_advanced_json.png

DDL Tool

The DDL Tool provides the ability to generate DDL for a given table, collection, or all database entities at once. To read more about using the DDL Tool from the command line (also known as KiDDL), review Kinetica Data Definition Language (KiDDL).

../_images/query_kiddl.png

Enter a table name, collection name, or *, and click Generate DDL to output the DDL to DDL Output. Click Export DDL to save the generated DDL as a SQL script.

The output from this utility can be copied into the SQL Statements area on the SQL Tool page and run in order to regenerate the database entities whose DDL has been generated.