title: Gremlin query output to CSV file
body: <p>I want to save the output returned by gremlin query to a CSV file with column names as labels of property and rows as values:</p>
  <p>Query:</p>
  <pre><code>g.V().as('v1').outE().as('e').inV().as('v2').select('v1','e','v2').by(valueMap()).limit(1)
  </code></pre>
  <p>Output:</p>
  <pre><code>[
      {
          &quot;v1&quot;: {
              &quot;label_A&quot;: [
                  &quot;A&quot;
              ] 
          },
          &quot;e&quot;: {
              &quot;label_E&quot;: &quot;E&quot;
          },
          &quot;v2&quot;: {
              &quot;label_B&quot;: [
          “B&quot;
              ]
          }
      }
  ]
  </code></pre>
  <p>Csv file required:</p>
  <pre><code>label_A,labelB,label_E
  A,B,E //row1
  .,.,. //row2 
  etc
  </code></pre>