Search code examples
pythonorientdb

How to get the edge object data of a vertex in orient db using python


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:

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

Here I want to rebind the out_': <pyorient.otypes.OrientBinaryObject object> using python. When I try this code to debind the object this error comes

print requiredObj[0].out_[0]

TypeError: 'OrientBinaryObject' object does not support indexing

Solution

  • You could use

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

    Hope it helps