Skip to main content

Gremlin-Python for Apache TinkerPop

Project description

Apache TinkerPop™ is a graph computing framework for both graph databases (OLTP) and graph analytic systems (OLAP). Gremlin is the graph traversal language of TinkerPop. It can be described as a functional, data-flow language that enables users to succinctly express complex traversals on (or queries of) their application’s property graph.

Gremlin-Python implements Gremlin within the Python language and can be used on any Python virtual machine including the popular CPython machine. Python’s syntax has the same constructs as Java including “dot notation” for function chaining (a.b.c), round bracket function arguments (a(b,c)), and support for global namespaces (a(b()) vs a(__.b())). As such, anyone familiar with Gremlin-Java will immediately be able to work with Gremlin-Python. Moreover, there are a few added constructs to Gremlin-Python that make traversals a bit more succinct.

Gremlin-Python is designed to connect to a “server” that is hosting a TinkerPop-enabled graph system. That “server” could be Gremlin Server or a remote Gremlin provider that exposes protocols by which Gremlin-Python can connect.

A typical connection to a server running on “localhost” that supports the Gremlin Server protocol using websockets from the Python shell looks like this:

>>> from gremlin_python.process.anonymous_traversal import traversal
>>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
>>> g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))

Once “g” has been created using a connection, it is then possible to start writing Gremlin traversals to query the remote graph:

>>> g.V().both()[1:3].toList()
[v[2], v[4]]
>>> g.V().both()[1].toList()
[v[2]]
>>> g.V().both().name.toList()
[lop, vadas, josh, marko, marko, josh, peter, ripple, lop, marko, josh, lop]

Please see the reference documentation at Apache TinkerPop for more information on usage.

NOTE that versions suffixed with “rc” are considered release candidates (i.e. pre-alpha, alpha, beta, etc.) and thus for early testing purposes only.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gremlinpython-3.4.6.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gremlinpython-3.4.6-py2.py3-none-any.whl (61.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gremlinpython-3.4.6.tar.gz.

File metadata

  • Download URL: gremlinpython-3.4.6.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for gremlinpython-3.4.6.tar.gz
Algorithm Hash digest
SHA256 426fa80b32f26583ccc447d9e6b198defda6925c84fda9e02afe67c643d1ef22
MD5 dd47ef8e91ffa15b26cec73a730fc5e3
BLAKE2b-256 91bb2ba8e1621fa76bdbb25c3a5d1ee8b04f5b17500020c90c97cb82cb15c98c

See more details on using hashes here.

File details

Details for the file gremlinpython-3.4.6-py2.py3-none-any.whl.

File metadata

  • Download URL: gremlinpython-3.4.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 61.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for gremlinpython-3.4.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b21867aa878ec622c398c922770a6ef5ffcc2728e96d00ddc5c734af0710cca5
MD5 31a80f784853b158daf372fdb5e6c8e8
BLAKE2b-256 cc7641a082862038798a7d80bb5a8583fd6203b8f34ea29cc03b78d3985a10ef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page