gremlinpython - How do you select(keys) in a graph_traversal?
Asked Answered
S

1

0

In this stackoverflow question a suggestion was made to use the query supplied in the first answer to do a particular gremlin_python traversal. Namely

g.V().has('name', 'USA').limit(1000).hasLabel('Country').
  map(union(project('id','label').
              by(id).
              by(label),
            valueMap()).unfold().
      group().
        by(keys).
        by(select(values)))

I am able to import all but "keys" from the gremlin_python graph traversal library like the following

from gremlin_python.process.graph_traversal import union, project, valueMap, select, key, values, id, label, map

Looking at the gremlin_python repo, I don't see a way to define the portion that is "by(keys)"

Does anyone know how this can be accomplished?

Styrax answered 31/5, 2019 at 15:53 Comment(0)
L
2

keys and values in that context should import from the Column enum - in the source code here. Note the full list of recommended imports in the Reference Documentation.

Loyalist answered 31/5, 2019 at 16:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.