dse_graph

Module Data

dse_graph.

__version_info__

The version of the driver extension in a tuple format

dse_graph.

__version__

The version of the driver extension in a string format

class DseGraph

Dse Graph utility class for GraphTraversal construction and execution.

Attributes

DSE_GRAPH_QUERY_LANGUAGE

= ‘bytecode-json’

Graph query language, Default is ‘bytecode-json’ (GraphSON).

Static Methods

static

create_execution_profile

(graph_name)

Creates an ExecutionProfile for GraphTraversal execution. You need to register that execution profile to the cluster by using cluster.add_execution_profile.

Parameters

graph_name – The graph name

static

query_from_traversal

(traversal)

From a GraphTraversal, return a query string based on the language specified in DseGraph.DSE_GRAPH_QUERY_LANGUAGE.

Parameters

traversal – The GraphTraversal object

static

traversal_source

(session=None, graph_name=None, execution_profile=EXEC_PROFILE_GRAPH_DEFAULT, traversal_class=None)

Returns a TinkerPop GraphTraversalSource binded to the session and graph_name if provided.

Parameters
  • session – (Optional) A DSE session

  • graph_name – (Optional) DSE Graph name

  • execution_profile – (Optional) Execution profile for traversal queries. Default is set to EXEC_PROFILE_GRAPH_DEFAULT.

  • traversal_class – (Optional) The GraphTraversalSource class to use (DSL).

from dse.cluster import Cluster
from dse_graph import DseGraph

c = Cluster()
session = c.connect()

g = DseGraph.traversal_source(session, 'my_graph')
print g.V().valueMap().toList()

class DSESessionRemoteGraphConnection

A Tinkerpop RemoteConnection to execute traversal queries on DSE.

Parameters
  • session – A DSE session

  • graph_name – (Optional) DSE Graph name.

  • execution_profile – (Optional) Execution profile for traversal queries. Default is set to EXEC_PROFILE_GRAPH_DEFAULT.

class BaseGraphRowFactory

Base row factory for graph traversal. This class basically wraps a graphson reader function to handle additional features of Gremlin/DSE and is callable as a normal row factory.

Currently supported:
  • bulk results

Parameters

graphson_reader – The function used to read the graphson.

Use example:

my_custom_row_factory = BaseGraphRowFactory(custom_graphson_reader.readObject)

Attributes

dse_graph.

graph_traversal_row_factory

dse_graph.

graph_traversal_dse_object_row_factory