You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2021/08/10 10:08:00 UTC
[jira] [Closed] (TINKERPOP-2599) Issue with the behavior of the
coalesce method on the last few versions of gremlinpython
[ https://issues.apache.org/jira/browse/TINKERPOP-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephen Mallette closed TINKERPOP-2599.
---------------------------------------
Fix Version/s: (was: 3.4.9)
Resolution: Not A Bug
In 3.5.0 child traversals must be anonymous:
https://tinkerpop.apache.org/docs/3.5.1/upgrade/#_anonymous_child_traversals
in other words, you can't spawn them with your "g".
> Issue with the behavior of the coalesce method on the last few versions of gremlinpython
> ----------------------------------------------------------------------------------------
>
> Key: TINKERPOP-2599
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2599
> Project: TinkerPop
> Issue Type: Bug
> Components: python
> Affects Versions: 3.4.10, 3.4.11, 3.5.1
> Reporter: Gaxinto Theodorio
> Priority: Major
>
> There's an issue with the functionality of the coalesce method in gremlin python. If you were to run the code below in version 3.4.9, you will find that the code works perfectly.
>
> {code:java}
> import os
> from gremlin_python import statics, structure
> from gremlin_python.process import graph_traversal
> from gremlin_python.structure.graph import Graph
> from gremlin_python.process.graph_traversal import __
> from gremlin_python.process.strategies import *
> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
> from gremlin_python.process.traversal import T, within,
> Cardinalitygremlin_enpoint = "ws://localhost:8182/gremlin"
> graph = Graph()
> remoteConn = DriverRemoteConnection(gremlin_enpoint, "g")
> g = graph.traversal().withRemote(remoteConn)
> response = (
> g.V()
> .fold()
> .coalesce( # if exists update and get
> g.V("mark"),
> # if not exist then create
> g.addV("Person").property(Cardinality.single, T.id, "mark")
> )
> .next()
> )
> print(response)
> {code}
> However, run the same exact code in the latest version and you will be greeted by the following error
>
> {code:java}
> Traceback (most recent call last):
> File "<redacted>/playground/scripts/test_coalesce.py", line 18, in <module>
> g.V("test")
> File "<redacted>/playground-zEQSuka0/lib/python3.9/site-packages/gremlin_python/process/graph_traversal.py", line 217, in coalesce
> self.bytecode.add_step("coalesce", *args)
> File "<redacted>/playground-zEQSuka0/lib/python3.9/site-packages/gremlin_python/process/traversal.py", line 603, in add_step
> instruction.append(self.__convertArgument(arg))
> File "<redacted>/playground-zEQSuka0/lib/python3.9/site-packages/gremlin_python/process/traversal.py", line 629, in __convertArgument
> raise TypeError("The child traversal of " + arg + " was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal")
> TypeError: can only concatenate str (not "GraphTraversal") to str
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)