2016-09-14 20 views
2
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] 

輸出:如何得到一個頂點的邊緣對象數據,在東方分貝使用python

#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'} 

這裏我要重新綁定out_': <pyorient.otypes.OrientBinaryObject object>使用python。當我嘗試此代碼debind對象這個錯誤出現

print requiredObj[0].out_[0] 

TypeError: 'OrientBinaryObject' object does not support indexing 

回答

2

你可以使用

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]) 

希望它可以幫助

相關問題