Search code examples
orientdbpyorient

OrientDB query works on Studio but not with PyOrient


This works on OrientDB Studio (eset is an embeddedSet):

UPDATE #37:0 SET eset = eset || ["foo", "bar"];

But not when I use PyOrient:

command = 'UPDATE #37:0 SET eset = eset || ["foo", "bar"];'
client.command(command)

>>> pyorient.exceptions.PyOrientSQLParsingException: com.orientechnologies.orient.core.sql.OCommandSQLParsingException - Error on parsing command: Invalid keyword ||.

Apparently it also happens with Java: https://community.orientdb.org/t/linkset-manipulation/171

Is there any way I could rewrite that query to get rid of the || part? I can't make heads or tails of the documentation.


Solution

  • PyOrient still uses the legacy SQL executor, that does not support || operator. I'd suggest to use the following (not completely equivalent, but it should work)

    UPDATE #37:0 ADD eset = ["foo", "bar"];