memlookup
Creates or drops an in-memory lookup table that can be called by the lookup command, or enumerates all the records created in the table.
Syntax
To enumerate in-memory lookup tables, or to enumerate records of the specific in-memory lookup table
To create an in-memory lookup table (using the data received by the pipe)
To drop an in-memory lookup table
Required Parameter
op={list|build|drop}
- Operation to be performed (default:
list
).build
: Builds a lookup table using the data received as input until the query command is complete.drop
: Drops the mapping table specified by thename
option.list
: Enumerates in-memory lookup table, or records of the lookup table specified by thename
option. If the lookup table is not created by memlookup, the query fails. If you execute thememlookup
command without any option, it is the same as executing it by specifying only theop=list
option.
name=TABLE
- Target table on which to run the operation specified by the
op={build|drop|list}
option. Whenop=list
, if you do not specify any lookup table, the result displays the metadata of all in-memory lookup tables. The information shown here is as follows: name (lookup name), key (key field name), and size (number of records of the lookup table). This option can be omitted whenop=list
. key=KEY_FIELD FIELD, ...
- Key field name when
op=build
. FIELD, ...
- Field names, separated by a comma (
,
), to be created whenop=build
.
Usage
-
Create a lookup table from a query.
Create a lookup table named
http_status
with thestatus
field as the key anddesc1
anddesc2
as the data field in a CSV file that hasstatus
,desc1
anddesc2
columns.csvfile http_status.csv | memlookup op=build name=http_status key=status desc1, desc2
-
Enumerate in-memory lookup tables.
You can see the lookup table information created by memlookup. The information returned is the lookup table name, key field, and the total number of records.
memlookup
The above command has the same result as the following command.
memlookup op=list
-
Enumerate all records in the specified lookup table.
If you enumerate the list by specifying the name of the lookup, you can see all the information for the lookup.
memlookup name=http_status
The above command has the same result as the following command.
memlookup op=list name=http_status
-
Drop an in-memory lookup table.
You can drop the specified lookup table by assigning drop as the value of the operator (op) option. If you do not specify a lookup name, an error occurs.
memlookup op=drop name=http_status