简体   繁体   中英

Append Entity on Microsoft Azure Table Storage Insert or Replace

I want to append something on entity while it exists and do not append the entity if it doesn't exist. How will I be able to achieve it? I tried following but it doesn't work the way I want.

task = table_service.get_entity('datas', '..com','asss','Hello') table_service.insert_or_replace_entity('tasktable', task)

If the entity exists: I want to append that hello with something as: ('datas', '..com','asss','Hello;123')

If the entity doesnt exist: I want to insert as: ('datas', '..com','asss','Hello')

If you want to append something to one existing entity property's value, it is impossible. Because Azure table storage does not provide any operation to do that. Azure Table storage just provides operations to manage entity and it does not provide operations to manage Azure table entity properties. So you just can set a new value for one existing entity property.

Regarding how to do that, we can use update or merge operation. But please note that the two operations will cause different result. The update operation replaces the entire entity. Those properties from the previous entity will be removed if the request does not define or include them. The merge operation does not replace the existing entity. Those properties from the previous entity will be retained if the request does not define or include them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM