0

I am trying to add a new vertex with a property whose value is a huge string. This is by using gremlin_python. Sample code:

vertex = g.addV(label).next()
res = g.V(vertex).property('key', 'this_is_a_huge_string')
Nick
  • 138,499
  • 22
  • 57
  • 95
sks27
  • 63
  • 2
  • 7
  • 2
    Welcome to SO. I'm not sure what you question is. Please review https://stackoverflow.com/help/how-to-ask and try to improve your question. – joanis Apr 25 '19 at 01:56
  • Thanks for getting back joanis. The question is how do I add a vertex with a property whose value is a huge string. Currently my program just for indefinite time with no exceptions! – sks27 Apr 25 '19 at 02:03
  • 1
    I'm not sure this is a complete, reproducible example, if for no other reason that `g` is not declared. Many people here are happy to help, but you have to help us help you by making it easy to reproduce your problem. Your comment about the program running for an indefinite time is helpful, it describes the problem you observe, but I think we need more information. – joanis Apr 25 '19 at 02:06

1 Answers1

1

I sense that your problem is that you are not iterating your second traversal:

vertex = g.addV(label).next()
res = g.V(vertex).property('key', 'this_is_a_huge_string').next()

Note that this is better written as a single statement as:

vertex = g.addV(label).property('key', 'this_is_a_huge_string').next()
stephen mallette
  • 45,298
  • 5
  • 67
  • 135
  • Thank you Stephen for your response. I do see a stacktrace now as below File "/virtualenvs/janusgraph-access/lib/python3.7/site-packages/gremlin_python/driver/protocol.py", line 69, in data_received data = json.loads(data.decode('utf-8')) AttributeError: 'NoneType' object has no attribute 'decode' – sks27 Apr 25 '19 at 15:04
  • I feel that the answer given is partially right. In fact, you are not iterating on the second line. Furthermore, you should also commit your transaction in order to persist the new vertex in the chosen backend. – D. Lawrence Apr 25 '19 at 15:49
  • since gremlin_python is being used i'd assumed that the transaction was being auto-committed by Gremlin Server – stephen mallette Apr 25 '19 at 15:52
  • noticed the additional information where this question is also posted on a mailing list: https://groups.google.com/d/msgid/janusgraph-users/729e5588-da61-4ad1-b3a2-7c42f5c7da21%40googlegroups.com?utm_medium=email&utm_source=footer - perhaps the `maxContentLength` on the server is too small? the default is 65536 i think – stephen mallette Apr 25 '19 at 15:57
  • Thanks a lot for your responses guys! Stephen, can you elaborate a bit more on how to set the maxContentLenght please ? – sks27 Apr 25 '19 at 15:59
  • Thanks a lot stephen! That was the issue. I was able to set maxContentLength to a higher value and it worked out. Thanks a lot and thank you everyone. – sks27 Apr 25 '19 at 16:09