Skip to main content
Loading

Aerospike Quick Look (AQL)

Aerospike Quick Look (AQL) is a tool for browsing the data in Aerospike Database.

caution

Previously deprecated index management and access control were removed in Tools 8.0.1.

Case sensitivityโ€‹

AQL commands, such as SELECT, and modifiers of commands, such as WHERE, are not case sensitive. The formal command syntax here shows uppercase, while many examples show lowercase.

Namespace names, bin names, and names of other objects are case-sensitive.

No relation to SQL, syntax differencesโ€‹

AQL is not SQL! The names just happen to be similar.

One syntactical difference between them is that SQL statements must end with a semicolon (;). AQL statements can terminate with a semicolon, but a semicolon is not required.

Get help with AQLโ€‹

AQL help details command-line options and commands. You can also type aql --help from the command line. The following commands can be upper- or lowercase:

  • HELP AGGREGATE
  • HELP DELETE
  • HELP DESC
  • HELP EXECUTE
  • HELP EXPLAIN
  • HELP GET
  • HELP INSERT
  • HELP REGISTER
  • HELP REMOVE
  • HELP RESET
  • HELP SELECT
  • HELP SET
  • HELP SHOW

Configuration fileโ€‹

Configure AQL with the standard Aerospike tools configuration file. See Aerospike Tools Configuration.

Start AQL and run commandsโ€‹

Start AQL on the Linux command-line with the following command.

aql

This command displays the prompt aql> where you enter AQL commands, modifiers, and arguments.

View specific recordsโ€‹

To look at the details of a specific record, use EXPLAIN SELECT.

You must use the primary key of the record.

EXPLAIN SELECT * FROM namespaceName.setName WHERE PK=valueOfPrimaryKey

Results for the valueOfPrimaryKey object are displayed as a table by default.

To display results in JSON format, you must set the output mode:

aql> SET OUTPUT JSON
OUTPUT = JSON

For other allowable values, enter HELP SET.

You can also specify outputmode = 'outputType' in your [configuration file](#configuration-file].

Register, show, and remove User-Defined Functions (UDFs)โ€‹

UDFs are programs you write in Lua that augment some of the basic features of Aerospike, such as aggregating or modifying data. For details, see the User-Defined Functions (UDF) Development Guide.

Register a UDFโ€‹

UDFs must be registered with the system. When you register a UDF module, the module is copied to all nodes in the cluster.

Assume you have already created a UDF. Use REGISTER MODULE to let the system know that it exists. The path to the module must be enclosed in double quotation marks:

REGISTER MODULE "pathToLuaFile"

Example

aql> REGISTER MODULE "udf/testudf.lua"
OK, 1 module added.

Show UDFs already registeredโ€‹

SHOW MODULES

The output shows the filename of the module, its type, which is Lua, and a hash.

Example

aql> SHOW MODULES
+---------------------------+-------+------------------------+
| module | type | hash |
+---------------------------+-------+------------------------+
| "example1.lua" | "lua" | "033671e05067888fce09" |
| "example2.lua" | "lua" | "07b42082cca8e73a96b2" |
+---------------------------+-------+------------------------+
2 rows in set (0.000 secs)

Remove registered UDFsโ€‹

To completely remove a UDF module from the system, use REMOVE MODULE.

Double quotation marks around the module name are optional.

Example

aql> REMOVE MODULE example2.lua