cassandra.datastax.graph.fluent
¶
-
class
cassandra.datastax.graph.fluent.
DseGraph
[source]¶ Dse Graph utility class for GraphTraversal construction and execution.
-
DSE_GRAPH_QUERY_LANGUAGE
= 'bytecode-json'¶ Graph query language, Default is ‘bytecode-json’ (GraphSON).
-
static
create_execution_profile
(graph_name, graph_protocol=b'graphson-2.0', **kwargs)[source]¶ 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
graph_protocol – (Optional) The graph protocol, default is DSE_GRAPH_QUERY_PROTOCOL.
-
static
query_from_traversal
(traversal, graph_protocol=b'graphson-2.0', context=None)[source]¶ From a GraphTraversal, return a query string based on the language specified in DseGraph.DSE_GRAPH_QUERY_LANGUAGE.
- Parameters
traversal – The GraphTraversal object
graph_protocol – The graph protocol. Default is DseGraph.DSE_GRAPH_QUERY_PROTOCOL.
context – The dict of the serialization context, needed for GraphSON3 (tuple, udt). e.g: {‘cluster’: cluster, ‘graph_name’: name}
-
static
traversal_source
(session=None, graph_name=None, execution_profile=EXEC_PROFILE_GRAPH_DEFAULT, traversal_class=None)[source]¶ 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 cassandra.cluster import Cluster from cassandra.datastax.graph.fluent import DseGraph c = Cluster() session = c.connect() g = DseGraph.traversal_source(session, 'my_graph') print g.V().valueMap().toList()
-
static
batch
(session=None, execution_profile=None)[source]¶ Returns the
cassandra.datastax.graph.fluent.query.TraversalBatch
object allowing to execute multiple traversals in the same transaction.
-
-
class
cassandra.datastax.graph.fluent.
DSESessionRemoteGraphConnection
(session[, graph_name, execution_profile])[source]¶ 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
cassandra.datastax.graph.fluent.
BaseGraphRowFactory
(cluster)[source]¶ 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
-
cassandra.datastax.graph.fluent.
graph_traversal_row_factory
¶ alias of
cassandra.datastax.graph.fluent._GremlinGraphSON2RowFactory
-
cassandra.datastax.graph.fluent.
graph_traversal_dse_object_row_factory
¶ alias of
cassandra.datastax.graph.fluent._DseGraphSON2RowFactory