gremlinrestclient icon indicating copy to clipboard operation
gremlinrestclient copied to clipboard

Create node with an attribute value None

Open sara-02 opened this issue 9 years ago • 1 comments

I have certain attributes in my dictionary whose value is None, but I am unable to add those as an attribute in my graph Example

>>>a= {"name":"package.json", "label":"package", "source":None}
>>>graph.create(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/graph.py", line 182, in create
    return self._create(script, bindings)
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/graph.py", line 185, in _create
    resp = self.execute(script, bindings=bindings)
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/client.py", line 40, in execute
    resp = self._post(self._url, json.dumps(payload))
  File "/usr/lib/python2.7/site-packages/gremlinrestclient/client.py", line 59, in _post
    raise GremlinServerError(resp.status_code, msg)
gremlinrestclient.exceptions.GremlinServerError: Code [500]: SERVER_ERROR. A general server error occurred that prevented the request from being processed..

Error encountered evaluating script: v16 = graph.addVertex(label, p0, 'source', p1, 'name', p2, );[[v16], []];

When I changed the source = "" it worked.

>>> a= {"name":"package.json", "label":"package", "source":""}
>>> graph.create(a)
Collection(vertices=(Vertex(id=16480, label=u'package', properties={u'source': [{u'id': u'4r0-cps-hdx', u'value': u''}], u'name': [{u'id': u'558-cps-1l1', u'value': u'package.json'}]}),), edges=())

sara-02 avatar Dec 15 '16 13:12 sara-02

See comments on #12

davebshow avatar Dec 15 '16 17:12 davebshow