Parameterized bulk insert (addV) script in gremlin-python

Scott Friedman

Good afternoon,

I'm attempting to use gremlin-python to do bulk vertex or edge inserts, and I'd figured I could use params to send in a simple script.  A simple proof of concept would be:

cmd = 'g.addV().property("name", values)'
params = { 'values': ['name1', 'name2'] }
result_set = conn._client.submit(cmd, params)

...but when I execute that, I get a single vertex added with "[name1, name2]" as its name.  I suppose this makes sense.  And is there a way to issue a compact loop-based script over an arbitrary list in my parameters?

I could always forego the script-based approach and use the python API to make a massive query of repeated addV() calls (which is my present implementation), but I'd hoped that a parameter-based, script-based solution would be more efficient (and elegant).

Suggestions are very welcome!


Join to automatically receive all group messages.