I am just trying out this CDT/Nested map operation in Python but not sure where I am going wrong. Using the latest docker image for Aerospike in default configuration. Any pointers will help.
I get this error: (-2, ‘Failed to convert ctx’, ‘src/main/conversions.c’, 2047, False)
The put operation is successful.
Here is my code
client = aerospike.Client({"hosts": ["0.0.0.0"]})
try:
print(datetime.now())
client.connect()
key = ("test", "chat_room_2", "userid")
bin_name = "complex_map_bin"
client.put(key,
{"bin1":
{
1523474230000: ['fav', {'sku':1, 'b':2}],
1523474231001: ['comment', {'sku':2, 'b':22}],
1523474236006: ['viewed', {'foo':'bar', 'sku':3, 'zz':'top'}],
1523474235005: ['comment', {'sku':1, 'c':1234}],
1523474233003: ['viewed', {'sku':3, 'z':26}],
1523474234004: ['viewed', {'sku':1, 'ff':'hhhl'}]
}
}
)
_, _, result = client.get(key)
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(result)
# Try using a context for a map operation
ctx = cdt_ctx.cdt_ctx_map_index(0)
ops = [
map_operations.map_get_by_key(
bin_name, "fav", aerospike.MAP_RETURN_VALUE, ctx
)
]
print(client.operate(key, ops))
client.close()
except Exception as e:
print(e)
sys.exit()