gpt4 book ai didi

python - 如何使用python获取orient db中顶点的边对象数据

转载 作者:太空宇宙 更新时间:2023-11-04 03:05:56 29 4
gpt4 key购买 nike

import pyorient

# create connection
client = pyorient.OrientDB("localhost", 2424)

# open databse
client.db_open( "Test", "admin", "admin" )

requiredObj = client.command(' select from chat where app_cat=appCategory and module=module and type=type and prob_cat=problemCategory ')

print requiredObj[0]

输出:

#Output
{'@Chat':{'prob_cat': 'PERFORMANCE', 'type': 'NON FUNCTIONAL', 'module': 'app', 'out_': <pyorient.otypes.OrientBinaryObject object at 0x10d1d6c10>, 'app_cat': 'RETAIL', 'issue': 'Non Capture of Data'},'version':7,'rid':'#22:0'}

这里我想重新绑定(bind)out_': <pyorient.otypes.OrientBinaryObject object>使用 python 。当我尝试使用此代码解除绑定(bind)对象时,出现此错误

print requiredObj[0].out_[0]

TypeError: 'OrientBinaryObject' object does not support indexing

最佳答案

你可以使用

requiredObj = client.command(' select expand(out()[0]) from chat where app_cat=appCategory and module=module and type=type and prob_cat=problemCategory  ')

print(requiredObj[0])

希望对你有帮助

关于python - 如何使用python获取orient db中顶点的边对象数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39483354/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com