Created
September 12, 2019 17:19
-
-
Save jbn/e979c336632cd1a1eba9e8dff9d28aae to your computer and use it in GitHub Desktop.
gremlin_python comparison for string execution versus local g
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[3619]" | |
] | |
}, | |
"execution_count": 1, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"from gremlin_python.driver import client\n", | |
"\n", | |
"gremlin_client = client.Client('ws://localhost:8182/gremlin', 'g')\n", | |
"gremlin_client.submit(\"g.V().count()\").next()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"3619" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"from gremlin_python import statics\n", | |
"from gremlin_python.structure.graph import Graph\n", | |
"from gremlin_python.process.graph_traversal import __\n", | |
"from gremlin_python.process.strategies import *\n", | |
"from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection\n", | |
"\n", | |
"graph = Graph()\n", | |
"g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))\n", | |
"g.V().count().next()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment