Tried to add a property that contains $
gremlin> g.V('some-node-id').property("money", "10 $")
groovysh_parse: 1: illegal string body character after dollar sign;
solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 1, column 72.
').property("money", "10 $")
So I escaped the $
symbol
gremlin> g.V('some-node-id').property("money", "10\$")
{"requestId":"xyz","code":"MalformedQueryException","detailedMessage":"Query parsing failed at line 1, character position at X, error message : token recognition error at: '$'"}
Type ':help' or ':h' for help.
Try a basic escaping, that worked fine
gremlin> g.V('some-node-id').property("money", "10\"")
==>v[some-node-id]
Double the escape $
since Neptune has gone crazy
gremlin> g.V('some-node-id').property("money", "10\\$")
groovysh_parse: 1: illegal string body character after dollar sign;
solution: either escape a literal dollar sign "\$5" or bracket the value expression "${5}" @ line 1, column 72.
').property("money", "10\\$")
^
Whats wrong in my query?
Thanks for reporting this issue. This has also been answered in the Amazon Neptune forums https://forums.aws.amazon.com/thread.jspa?messageID=862849
The workaround for this problem is to use single quotes around the string where you are adding the $ sign. For example:
gremlin> g.addV("Animal").property(id,"simba")
==>v[simba]
gremlin> g.V('simba').property('money','$123')
==>v[simba]
gremlin> g.V().has('money','$123')
==>v[simba]
gremlin> g.V('simba').property('new_money','123 $10')
==>v[simba]
However, I do understand that it should work with the double quotes as well after you escape the $. This is a bug in our parser and we are actively working on a fix.
Further I should note that the bug only impacts the clients written in groovy language which send queries as strings e.g. gremlin console. GLVs (Java/Python/DotNet/JS) and other string-based clients where the '$' character is not a reserved character will work just fine.
Regards,
Divij