Hello,
I'm trying to use the DSE Graph API to interact with the Graph store but I find it quite challenging to understand the syntax of the Graph API using Gremlin statements from a Python script.
This works correctly:
res = session.execute_graph('''A = g.addV(label, 'A')[0]
B = g.addV(label, 'B')[0]
A.addEdge('edge', B)''')
But it's not very "Pythonic", if I want to create more complex queries I will end up working on building on the fly strings which is error-prone.
I'm trying to do something like that but it fails:
A = session.execute_graph('''g.addV(label, 'A')''')[0]
B = session.execute_graph('''g.addV(label, 'B')''')[0]
res = session.execute_graph('''A.addEdge('edge', B)''', {'A': A, 'B': B})
-> TypeError: Vertex({u'community_id': 516547968, u'~label': u'A', u'member_id': 512}, u'A', u'vertex', {}) is not JSON serializable
I don't know if that's a problem with the API or a problem with my vision on the usage of the API.
Thanks
Jerome