如何读取和更新python plasma中的对象?

2024-04-28 04:44:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚刚发现了血浆https://arrow.apache.org/docs/python/plasma.html#putting-and-getting-python-objects 并希望存储一个对象,获取它,更新并写回存储。 有可能吗? 我失败的审判现在看来如下:

import pyarrow.plasma as plasma


client = plasma.connect("/tmp/plasma")

obj={'val1':1, 'val2':2,'a':[1,2,3]}
obj_id = client.put(obj)

pobj=client.get(obj_id)

pobj['yyy']=999

#now how to write it back??
client.put(pobj, obj_id) #throws an error: pyarrow.lib.PlasmaObjectExists: object already exists in the plasma store


print("object id: "+str(obj_id))
pobj2=client.get(obj_id)
print("object id2: "+str(pobj2))

Tags: httpsclientidobjgetobjectputprint