How do you get the Titan chart database working with Python?

I am new to this and I am trying to get Titan to work with Python. I hit my head about it for a day and a half and can’t go anywhere. I tried light bulbs and rexpro-python, but nothing works.

The following code is provided in rexpro-python :

from rexpro import RexProConnection conn = RexProConnection('localhost', 8184, 'graph') 

will freeze and the server will display the following message (for versions titan 0.3.2, 0.3.1 and 0.2.1)

 13/09/18 16:59:27 WARN filter.RexProMessageFilter: unsupported rexpro version: 1 

In Light Bulb :

 from bulbs.config import Config, DEBUG from bulbs.rexster import Graph config = Config('http://localhost:8182/graphs/graph') g = Graph(config) 

It produces the following error:

 SystemError: ({'status': '500', 'transfer-encoding': 'chunked', 'server': 'grizzly/2.2.16', 'connection': 'close', 'date': 'Wed, 18 Sep 2013 21:06:27 GMT', 'access-control-allow-origin': '*', 'content-type': 'application/json'}, '{"message":"","error":"javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException.idx() is applicable for argument types: () values: []\\nPossible solutions: is(java.lang.Object), any(), find(), any(groovy.lang.Closure), with(groovy.lang.Closure), _(groovy.lang.Closure)","api":{"description":"evaluate an ad-hoc Gremlin script for a graph.","parameters":{"rexster.returnKeys":"an array of element property keys to return (default is to return all element properties)","rexster.showTypes":"displays the properties of the elements with their native data type (default is false)","load":"a list of \'stored procedures\' to execute prior to the \'script\' (if \'script\' is not specified then the last script in this argument will return the values","rexster.offset.end":"end index for a paged set of data to be returned","rexster.offset.start":"start index for a paged set of data to be returned","params":"a map of parameters to bind to the script engine","language":"the gremlin language flavor to use (default to groovy)","script":"the Gremlin script to be evaluated"}},"success":false}') 

with a similar exception on the Titan server. Has anyone got this to work?

+6
source share
2 answers

In the case of rexpro-python, you have a version issue. The latest version of RexPro Python will connect to TinkerPop / Rexster 2.4.0. Titan does not yet support this version. Starting with Titan 0.3.2, it supports TinkerPop 2.3.x. It seems like this is the last commit before compatibility with bump to 2.4.0 for rexpro-python:

https://github.com/bdeggleston/rexpro-python/commit/3597f4ce5a4da69ec64f174aa1a064abf7524693

but you can look at the commit history a bit to make sure you got the correct option.

Light bulbs look like they are referencing a manual index that Titan does not support. There are several posts about this in gremlin-users and / or areuliusgraphs mailing lists. See this post with a link to your specific problem:

https://groups.google.com/forum/#!msg/gremlin-users/s7Ag1tjbxLs/nC5WjtHh6woJ

Short answer, it looks like the bulbs have been updated to support Titan. Perhaps you have some version incompatibility somewhere else.

+1
source

With Titan 1.0.0 or later, we have better ways to connect from python.

Now titanium comes with a Gremlin server. The Gremlin server provides the ability to use non-JVM languages ​​(e.g. Python, Javascript, etc.) to communicate with the TinkerPop glass.

The Gremlin server replaces Rexster .

To start the gremlin server (this script is packed with titanium):

 sh gremlin-server.sh 

A similar batch of script is available for windows in the same directory.

After starting, the following python drivers should connect to the Gremlin server:

  • aiogremlin is a Python 3 library based on asyncio and aiohttp that uses web ports to communicate with a Gremlin server.
  • gremlinclient is a Python 2/3 asynchronous client for the Gremlin server, which allows using the flexible coroutine syntax - Trollius, Tornado, Asyncio. This is from the same author as Ayogremlin. I believe aiogremlin is no longer supported, and this is the last project he is working on.
  • gremlinrestclient is a Python 2/3 library that uses HTTP to communicate with a Gremlin server via REST.

Python-based query language libraries that can help during development:

  • gremlin-py - Write a clean Python Gremlin that can be sent to the Gremlin server.
  • gremlin-python - Allows the use of Python syntax when traversing property graphs.
+1
source

Source: https://habr.com/ru/post/954107/


All Articles