Client.get is not working if key is the map

Hi All,

There are 2 scenerios, first scenerio it is working as expected but in second it is throwing an exception

First Scenerio below is the data

aql> select * from foo.test; ±-------±-----------±------------------------- | $dummy | modifiedBy | schemaVersion | id | ±-------±-----------±--------------±--------+ | 0 | “smadmin” | 11111111111 | “test2” | ±-------±-----------±------------------------- 1 row in set (1.601 secs)

OK

Using below python code to fetch data and it is working as expected key = (‘foo’, ‘test’, ‘test2’) (key, meta, bins) = client.get(key)

Second scenerio below is the data

aql> select * from foo.test2; ±---------------±-------------------------------------------------------------+ | schemaVersion | id | ±---------------±-------------------------------------------------------------+ | 11111111111 | MAP(‘{“Id”:1649820976786, “pat”:“test1”}’) | ±---------------±-------------------------------------------------------------+ 1 row in set (1.392 secs)

OK

Using below python code to fetch data and it is throwing an exception key = (“foo”, “test2”, “{‘pat’: ‘test1’, ‘Id’: 1649820976786}”) (key, meta, bins) = client.get(key)

How to fetch data if the key is the map

Thanks Gajendra

You seem to be confusing between two different keys: record key and map key.

  • A bin in a record (such as the bin “id” in the second example) can have a Map data type.
  • A record key is a tuple (namespace, set, primary key [, optional digest]) - see this - where the primary key - also not to be confused with either the record key or a map key - can be a string, int, or bytearray.

Aerospike provides a comprehensive set of operations for the Map type, including accessing a specific map element by its key. Note, the request must specify the record key to identify the record in which the Map bin resides, as well as the map element’s key.