GitHub user davebshow opened a pull request:
https://github.com/apache/tinkerpop/pull/389
Implemented side effect interface for gremlin-python
This is my first go at implementing a side effects interface for
gremlin-python. It allows you to do things like:
```python
from gremlin_python.structure import Graph
from gremlin_python.driver.driver_remote_connection import
DriverRemoteConnection
rc = DriverRemoteConnection('ws://localhost:8182', 'g')
graph = Graph()
g = graph.traversal().withRemote(rc)
resp = g.V().aggregate('a')
side_effects = resp.sideEffects()
side_effects.keys() # a list of keys
for x in side_effects.get('a'):
print(x)
```
Alternately, if the traversal has already been executed, the side effects
interface can be accessed like a property:
```python
traversal = g.V().aggregate('a')
results = traversal.toList()
side_effects = traversal.side_effects.get('a')
# or call like a function as in previous example:
side_effects = traversal.sideEffects().get('a')
```
Now, there may be some cleanup or review necessary, in general I would like
to review property getters and setters for the gremlin-python module.
Also note, the above examples are run against the 1278 branch with a
configuration that includes the GraphSON v2 serializer:
```
- { className:
org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0,
config: { useMapperFromGraph: graph }} # application/vnd.gremlin-v2.0+json
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/davebshow/tinkerpop
gremlin_python_side_effects
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/389.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #389
----
commit 768c053e9c2b70ee345fdde5ca9ce40d014cac31
Author: davebshow <[email protected]>
Date: 2016-08-23T20:33:29Z
Implemented side effect interface for gremlin-ppython
commit 8b0927378ef1f929035b14a0b4340065578ea3fb
Author: davebshow <[email protected]>
Date: 2016-08-23T20:37:53Z
removed print statement
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---