Menu

cassandra.datastax.graph.fluent.query

class cassandra.datastax.graph.fluent.query.TraversalBatch(session=None, execution_profile=None)[source]

A TraversalBatch is used to execute multiple graph traversals in a single transaction. If any traversal in the batch fails, the entire batch will fail to apply.

If a TraversalBatch is bounded to a DSE session, it can be executed using traversal_batch.execute().

Parameters
  • session – (Optional) A DSE session

  • execution_profile – (Optional) The execution profile to use for the batch execution

add(traversal)[source]

Add a traversal to the batch.

Parameters

traversal – A gremlin GraphTraversal

add_all(traversals)[source]

Adds a sequence of traversals to the batch.

Parameters

traversals – A sequence of gremlin GraphTraversal

execute()[source]

Execute the traversal batch if bounded to a DSE Session.

as_graph_statement(graph_protocol=b'graphson-2.0')[source]

Return the traversal batch as GraphStatement.

Parameters

graph_protocol – The graph protocol for the GraphSONWriter. Default is GraphProtocol.GRAPHSON_2_0.

clear()[source]

Clear a traversal batch for reuse.