I am trying to develop python programs to set up a multi-omics graph database in OrientDB, starting with the gene-transcript-protein relations from Ensembl. A completely unexpected problem I have run into is that the python interface (pyorient/pyorientdb),for queries like client.command("SELECT uID FROM Protein") seems to always return the internal ID of the record, not the property (iUD) I am asking for, as you would expect (and Studio does). This is not a special problem with uID (might be consider an index, triggering a special behaviour), but seems to happen with any property. e.g.
loadedProteinUIDs=client.command("select uID from Protein LIMIT 5") print(loadedProteinUIDs) loadedProteinXIDs=client.command("select xID from Protein LIMIT 5") print(loadedProteinXIDs) loadedProteinXXXs=client.command("select xxx from Protein LIMIT 5") print(loadedProteinXXXs) ... [<pyorientdb.otypes.OrientRecord object at 0x14a551a30>, <pyorientdb.otypes.OrientRecord object at 0x14a5517f0>, <pyorientdb.otypes.OrientRecord object at 0x14a551a90>, <pyorientdb.otypes.OrientRecord object at 0x14a551940>, <pyorientdb.otypes.OrientRecord object at 0x14a5512b0>] [<pyorientdb.otypes.OrientRecord object at 0x14a551a30>, <pyorientdb.otypes.OrientRecord object at 0x14a5517f0>, <pyorientdb.otypes.OrientRecord object at 0x14a551a90>, <pyorientdb.otypes.OrientRecord object at 0x14a551940>, <pyorientdb.otypes.OrientRecord object at 0x14a5512b0>] [<pyorientdb.otypes.OrientRecord object at 0x14a551fa0>, <pyorientdb.otypes.OrientRecord object at 0x14a551b50>, <pyorientdb.otypes.OrientRecord object at 0x14a551d30>, <pyorientdb.otypes.OrientRecord object at 0x14a551d90>, <pyorientdb.otypes.OrientRecord object at 0x14ae01040>]
Studio seems to go through the REST interface, giving the correct result. I have, as yet, no idea, why the python interface does not give the same results. Any suggestions would be great. Thanks Hans
The pyorient driver for OrientDB returns a list of OrientRecord objects when you query the database using
client.command()orclient.query(). In order to access the data you are looking for, you need to call theoRecordDataproperty of these objects: