How to update the value of a record using PK value




i have test namespace,demo set and some records

"email": "",
"id": 12345 ,
"date": {
     "Jun": [ "3", "4" ],
     "July": [ "12", "7" ] 

i want to update only “Jun” field with using PK value or secondary index.

ex: update into test.demo date.Jun=[ "2", "31" ] where PK=1

If this is not possible with aql ,can u please provide solution in python client

import aerospike
# Open connection to the server
config = { 'hosts': [ ("localhost", 3000), ] }
client = aerospike.client(config).connect()

key = ("test", "demo", 1)
client.map_put(key, bin="date", map_key="Jun", val=["3","4"])
ret_val=client.map_get_by_key(key, bin="date", map_key='Jun', return_type=aerospike.MAP_RETURN_VALUE)
print ret_val

For other API calls available, see python client documentation.


Thank you :grinning: @pgupta


hello @pgupta

if i update like this

key = (“test”, “demo”, 1) client.map_put(key, bin=“date”, map_key=“Jun”, val=[“3”,“4”]) ret_val=client.map_get_by_key(key, bin=“date”, map_key=‘Jun’, return_type=aerospike.MAP_RETURN_VALUE) print ret_val

Here only one map_key value is updating, I have 100 map_keys in my records, its taking time to update one by one map_key, how to update multiple map_keys at a time?

ex:client.map_put(key, bin=“date”, map_key=“Jun”,"July val=[“3”,“4”],[“1”,“2”])

i tried this but getting arg error :frowning_face:


Use map_put_items() , see usage here: