Reputation: 11
So I'm trying to follow the instructions on this thread Send string gremlin query to Amazon Neptune database using TinkerPop's gremlinpython, but it's not working with the mergeV example extracted directly from AWS Neptune Docs. A simple "g.V().limit(10)" it works, though. What am I doing wrong?
I tried this:
from gremlin_python.driver import client
import os
# Neptune connection setup
neptune_endpoint = os.getenv('NEPTUNE_ENDPOINT')
neptune_port = os.getenv('NEPTUNE_PORT')
neptune_uri = f'wss://{neptune_endpoint}:{neptune_port}/gremlin'
conn = client.Client(neptune_uri,'g')
query = """
g.mergeV([(T.id): 'v-1']).
option(onCreate, [(T.label): 'PERSON', email: '[email protected]', age: 21]).
option(onMatch, [age: 22]).
id()
"""
result = conn.submit(query)
results = result.all().result()
print(results)
and got this:
Received error message '{'requestId': '00f7a9b8-8a42-4a94-8e62-a2f28f3e2385', 'status': {'code': 499, 'message': '{"detailedMessage":"Failed to interpret Gremlin query: Query parsing failed at line 2, character position at 2, error message : token recognition error at: 'mer'","requestId":"00f7a9b8-8a42-4a94-8e62-a2f28f3e2385","code":"MalformedQueryException"}', 'attributes': {}}, 'result': {'meta': {}, 'data': None}}'
Upvotes: 0
Views: 175
Reputation: 14391
The mergeV
step was added to Apache TinkerPop as part of the 3.6.x release line. The first Amazon Neptune engine version to support Gremlin at that level was 1.2.1.0.
Upgrading your Neptune engine version to at least that level should allow both mergeV
and mergeE
to work. See also: https://docs.aws.amazon.com/neptune/latest/userguide/engine-releases-1.2.1.0.html
Upvotes: 1