简体   繁体   中英

Gremlin query output to CSV file

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:

Query:

g.V().as('v1').outE().as('e').inV().as('v2').select('v1','e','v2').by(valueMap()).limit(1)

Output:

[
    {
        "v1": {
            "label_A": [
                "A"
            ] 
        },
        "e": {
            "label_E": "E"
        },
        "v2": {
            "label_B": [
        “B"
            ]
        }
    }
]

Csv file required:

label_A,labelB,label_E
A,B,E //row1
.,.,. //row2 
etc

While it was written for Amazon Neptune, there's very little about this tool that is specific to Neptune:

https://github.com/awslabs/amazon-neptune-tools/tree/master/neptune-export

See in particular:

https://github.com/awslabs/amazon-neptune-tools/blob/master/neptune-export/docs/export-pg-from-queries.md

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM