Date
1 - 3 of 3
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! Regards, Scott |
|
hadoopmarc@...
Hi Scott,
You can try to use this thread for inspiration: https://groups.google.com/g/gremlin-users/c/HtBRwaU0pnQ/m/duFs5-imBAAJ 2 1/2 years ago I was impressed by this solution! This really iterates over the input data and add multiple vertices. Best wishes, Marc |
|
Scott Friedman
Wow, works like a charm using gremlin-python, and I don't even have to use a script!
Thanks for the quick wisdom! SF |
|