0

I have a gremlin query and have been struggling to save the query result into a file.

Given below is the query

g.V().hasLabel('tp21tpcust').local(repeat(out().simplePath()).until(__.not(out())).path().by(id).limit(100)).local(unfold().union(limit(1),tail()).fold()).dedup()

I am running it directly in Gremlin shell. The record option does not help and below is how it showed up in the recorded file

[ec2-user@ip-172-31-26-206 ~]$ cat -n /home/ec2-user/apache-tinkerpop-gremlin-console-3.4.3/result_g.txt
     1  // OPENED: Tue Nov 17 14:28:16 UTC 2020
     2  // RESULT: result_g.txt
     3  g.V().hasLabel('tp21tpcust').local(repeat(out().simplePath()).until(__.not(out())).path().by(id).limit(100)).local(unfold().union(limit(1),tail()).fold()).dedup()
     4  // RESULT: java.util.Spliterators$1Adapter@5e671e20
     5  :record stop
     6  // CLOSED: Tue Nov 17 14:28:33 UTC 2020

Sample Query result in Console :

==>[A1018GOAB6BLGC, A2B7HOWI080GFJ]
==>[A10844U5NG65IO, APA9EOTE9PT8Q]
==>[A10FR6XSVH309T, A1J5QCFZDTZXLQ]
==>[A10GFNM2PXXMFV, A16WJ4MUQ8XEWD]
==>[A10L0159IIPKR6, A2B7HOWI080GFJ]

I would prefer having it as a 2 column csv file and unable to get to capture the full result. Furthermore is there an option to return full dataset ? the console is breaking into multiple pages of 100 rows each.

Thanks

zulfi123786
  • 165
  • 1
  • 2
  • 13

1 Answers1

0

The Gremlin Console maintains a special variable called result that you can take advantage of. I answered a similar question at the following link.

Variables - Gremlin on Neptune

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38