orientechnologies / pyorient

OrientDB driver for Python that uses the binary protocol.
Apache License 2.0
119 stars 38 forks source link

Updating records without mangling edges #4

Closed ryan-stateless closed 9 years ago

ryan-stateless commented 9 years ago

I'm playing around with the pyorient driver and I've encountered a "I must be doing it wrong" problem. Consider this sample code:

orient_client.db_open( "database", "admin", "admin" ) record = orient_client.query("select from V where some_field = 'some value'")[0] cluster_id = parse_cluster_id(record._rid) cluster_position = parse_cluster_position(record._rid) record.oRecordData["some_field"] = "some other value" orient_client.record_update(cluster_id, cluster_position, record)

When I run this code the field is updated correctly, however the IN/OUT edges get mangled. This is because the deserialization of binary data in the query result stores the edges as OrientBinaryObject (base64 strings). When the record_update() is written, the edge collections are stomped with these strings.

How do I read, update, write without tripping over the missing ridbag handling in pyorient?

Ostico commented 9 years ago

Hi @ryan-stateless ,

i think this is a bug, i will investigate, thanks for reporting it. I suggest for the moment to use SQL queries instead of CRUD methods if you have ridbag concerns.

Ostico commented 9 years ago

Moved https://github.com/mogui/pyorient/issues/97