How do I retrieve the meta-data of a record from AQL?


#1

Summary

To retrieve the meta-data of a record which are digest, generation and TTL, use the RECORD_PRINT_METADATA setting in AQL. Note that this setting is valid only in JSON view mode.

Example

aql> SET OUTPUT JSON
aql> SET RECORD_PRINT_METADATA true
aql> insert into test.testset (PK,bin) values (200,20000)
OK, 1 record affected.

aql> select * from test.testset where PK=200
[
  {
    "digest": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=",
    "ttl": 2592000,
    "gen": 1,
    "bins": {
      "bin": 20000
    }
  }
]

Documentation reference for more AQL settings: http://www.aerospike.com/docs/tools/aql/settings.html

To know more about data-model in Aerospike: http://www.aerospike.com/docs/architecture/data-model.html


#2

For others’ reference. To revert back to tabular view:

SET OUTPUT TABLE

Also, it appears that AQL displays digest/ttl/generation data in tabular view as well, at least as of 3.9.x:

+--------------+-------------+--------------------------------+------------+-------+
| a            | maxNumLists | {digest}                       | {ttl}      | {gen} |
+--------------+-------------+--------------------------------+------------+-------+
| 10           | 2           | "Mj6QJaUNFYKk+urOhhaHMuiwqu0=" | 4294967295 | 1     |
+--------------+-------------+--------------------------------+------------+-------+