Skip to content

Commit 2e33c9c

Browse files
committed
Add cassandra.graph api docs
1 parent 5f765f0 commit 2e33c9c

File tree

6 files changed

+207
-8
lines changed

6 files changed

+207
-8
lines changed

cassandra/datastax/graph/query.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
('graph_source', 'choose the graph traversal source, configured on the server side.', 'graph-source'),
3636
('graph_language', 'the language used in the queries (default "gremlin-groovy")', 'graph-language'),
3737
('graph_protocol', 'the graph protocol that the server should use for query results (default "graphson-1-0")', 'graph-results'),
38-
('graph_read_consistency_level', '''read `dse.ConsistencyLevel <http://docs.datastax.com/en/developer/python-driver/latest/api/cassandra/#cassandra.ConsistencyLevel>`_ for graph queries (if distinct from session default).
38+
('graph_read_consistency_level', '''read `cassandra.ConsistencyLevel <http://docs.datastax.com/en/developer/python-driver/latest/api/cassandra/#cassandra.ConsistencyLevel>`_ for graph queries (if distinct from session default).
3939
Setting this overrides the native `Statement.consistency_level <http://docs.datastax.com/en/developer/python-driver/latest/api/cassandra/query/#cassandra.query.Statement.consistency_level>`_ for read operations from Cassandra persistence''', 'graph-read-consistency'),
40-
('graph_write_consistency_level', '''write `dse.ConsistencyLevel <http://docs.datastax.com/en/developer/python-driver/latest/api/cassandra/#cassandra.ConsistencyLevel>`_ for graph queries (if distinct from session default).
40+
('graph_write_consistency_level', '''write `cassandra.ConsistencyLevel <http://docs.datastax.com/en/developer/python-driver/latest/api/cassandra/#cassandra.ConsistencyLevel>`_ for graph queries (if distinct from session default).
4141
Setting this overrides the native `Statement.consistency_level <http://docs.datastax.com/en/developer/python-driver/latest/api/cassandra/query/#cassandra.query.Statement.consistency_level>`_ for write operations to Cassandra persistence.''', 'graph-write-consistency')
4242
)
4343
_graph_option_names = tuple(option[0] for option in _graph_options)
@@ -121,7 +121,7 @@ def set_source_graph(self):
121121

122122
def set_graph_protocol(self, protocol):
123123
"""
124-
Sets ``graph_protocol`` as server graph results format (See :class:`dse.graph.GraphProtocol`)
124+
Sets ``graph_protocol`` as server graph results format (See :class:`cassandra.datastax.graph.GraphProtocol`)
125125
"""
126126
self.graph_protocol = protocol
127127

@@ -195,7 +195,7 @@ def single_object_row_factory(column_names, rows):
195195

196196
def graph_result_row_factory(column_names, rows):
197197
"""
198-
Returns a :class:`cassandra.graph.Result` object that can load graph results and produce specific types.
198+
Returns a :class:`Result <cassandra.datastax.graph.Result>` object that can load graph results and produce specific types.
199199
The Result JSON is deserialized and unpacked from the top-level 'result' dict.
200200
"""
201201
return [Result(json.loads(row[0])['result']) for row in rows]
@@ -205,7 +205,7 @@ def graph_object_row_factory(column_names, rows):
205205
"""
206206
Like :func:`~.graph_result_row_factory`, except known element types (:class:`~.Vertex`, :class:`~.Edge`) are
207207
converted to their simplified objects. Some low-level metadata is shed in this conversion. Unknown result types are
208-
still returned as :class:`dse.graph.Result`.
208+
still returned as :class:`Result <cassandra.datastax.graph.Result>`.
209209
"""
210210
return _graph_object_sequence(json.loads(row[0])['result'] for row in rows)
211211

docs/api/cassandra/cluster.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@
128128
.. autodata:: EXEC_PROFILE_DEFAULT
129129
:annotation:
130130

131+
.. autodata:: EXEC_PROFILE_GRAPH_DEFAULT
132+
:annotation:
133+
134+
.. autodata:: EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT
135+
:annotation:
136+
137+
.. autodata:: EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT
138+
:annotation:
139+
131140
.. autoclass:: Session ()
132141

133142
.. autoattribute:: default_timeout
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
``cassandra.datastax.graph`` - Graph Statements, Options, and Row Factories
2+
===========================================================================
3+
4+
.. _api-datastax-graph:
5+
6+
.. module:: cassandra.datastax.graph
7+
8+
.. autofunction:: single_object_row_factory
9+
10+
.. autofunction:: graph_result_row_factory
11+
12+
.. autofunction:: graph_object_row_factory
13+
14+
.. autoclass:: GraphProtocol
15+
:members:
16+
17+
.. autoclass:: GraphOptions
18+
19+
.. autoattribute:: graph_name
20+
21+
.. autoattribute:: graph_source
22+
23+
.. autoattribute:: graph_language
24+
25+
.. autoattribute:: graph_read_consistency_level
26+
27+
.. autoattribute:: graph_write_consistency_level
28+
29+
.. autoattribute:: is_default_source
30+
31+
.. autoattribute:: is_analytics_source
32+
33+
.. autoattribute:: is_graph_source
34+
35+
.. automethod:: set_source_default
36+
37+
.. automethod:: set_source_analytics
38+
39+
.. automethod:: set_source_graph
40+
41+
42+
.. autoclass:: SimpleGraphStatement
43+
:members:
44+
45+
.. autoclass:: Result
46+
:members:
47+
48+
.. autoclass:: Vertex
49+
:members:
50+
51+
.. autoclass:: VertexProperty
52+
:members:
53+
54+
.. autoclass:: Edge
55+
:members:
56+
57+
.. autoclass:: Path
58+
:members:
59+
60+
.. autoclass:: GraphSON1Serializer
61+
:members:
62+
63+
.. autoclass:: GraphSON1Deserializer
64+
65+
.. automethod:: deserialize_date
66+
67+
.. automethod:: deserialize_timestamp
68+
69+
.. automethod:: deserialize_time
70+
71+
.. automethod:: deserialize_duration
72+
73+
.. automethod:: deserialize_int
74+
75+
.. automethod:: deserialize_bigint
76+
77+
.. automethod:: deserialize_double
78+
79+
.. automethod:: deserialize_float
80+
81+
.. automethod:: deserialize_uuid
82+
83+
.. automethod:: deserialize_blob
84+
85+
.. automethod:: deserialize_decimal
86+
87+
.. automethod:: deserialize_point
88+
89+
.. automethod:: deserialize_linestring
90+
91+
.. automethod:: deserialize_polygon
92+
93+
.. autoclass:: GraphSON2Reader
94+
:members:

docs/api/cassandra/graph.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
``cassandra.graph`` - Graph Statements, Options, and Row Factories
2+
==================================================================
3+
4+
.. note:: This module is only for backward compatibility for dse-driver users. Consider using :ref:`cassandra.datastax.graph <api-datastax-graph>`.
5+
6+
.. module:: cassandra.graph
7+
8+
.. autofunction:: single_object_row_factory
9+
10+
.. autofunction:: graph_result_row_factory
11+
12+
.. autofunction:: graph_object_row_factory
13+
14+
.. autoclass:: GraphProtocol
15+
:members:
16+
17+
.. autoclass:: GraphOptions
18+
19+
.. autoattribute:: graph_name
20+
21+
.. autoattribute:: graph_source
22+
23+
.. autoattribute:: graph_language
24+
25+
.. autoattribute:: graph_read_consistency_level
26+
27+
.. autoattribute:: graph_write_consistency_level
28+
29+
.. autoattribute:: is_default_source
30+
31+
.. autoattribute:: is_analytics_source
32+
33+
.. autoattribute:: is_graph_source
34+
35+
.. automethod:: set_source_default
36+
37+
.. automethod:: set_source_analytics
38+
39+
.. automethod:: set_source_graph
40+
41+
42+
.. autoclass:: SimpleGraphStatement
43+
:members:
44+
45+
.. autoclass:: Result
46+
:members:
47+
48+
.. autoclass:: Vertex
49+
:members:
50+
51+
.. autoclass:: VertexProperty
52+
:members:
53+
54+
.. autoclass:: Edge
55+
:members:
56+
57+
.. autoclass:: Path
58+
:members:
59+
60+
.. autoclass:: GraphSON1Serializer
61+
:members:
62+
63+
.. autoclass:: GraphSON1Deserializer
64+
65+
.. automethod:: deserialize_date
66+
67+
.. automethod:: deserialize_timestamp
68+
69+
.. automethod:: deserialize_time
70+
71+
.. automethod:: deserialize_duration
72+
73+
.. automethod:: deserialize_int
74+
75+
.. automethod:: deserialize_bigint
76+
77+
.. automethod:: deserialize_double
78+
79+
.. automethod:: deserialize_float
80+
81+
.. automethod:: deserialize_uuid
82+
83+
.. automethod:: deserialize_blob
84+
85+
.. automethod:: deserialize_decimal
86+
87+
.. automethod:: deserialize_point
88+
89+
.. automethod:: deserialize_linestring
90+
91+
.. automethod:: deserialize_polygon
92+
93+
.. autoclass:: GraphSON2Reader
94+
:members:

docs/api/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Core Driver
1010
cassandra/cluster
1111
cassandra/policies
1212
cassandra/auth
13+
cassandra/graph
1314
cassandra/metadata
1415
cassandra/metrics
1516
cassandra/query
@@ -46,6 +47,7 @@ DataStax Graph
4647
.. toctree::
4748
:maxdepth: 1
4849

50+
cassandra/datastax/graph/index
4951
cassandra/datastax/graph/fluent/index
5052
cassandra/datastax/graph/fluent/query
5153
cassandra/datastax/graph/fluent/predicates

docs/graph.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ executing gremlin queries in DSE Graph.
77

88
Three Execution Profiles are provided suitable for graph execution:
99

10-
* :data:`.cluster.EXEC_PROFILE_GRAPH_DEFAULT`
11-
* :data:`.cluster.EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT`
12-
* :data:`.cluster.EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT`
10+
* :data:`~.cluster.EXEC_PROFILE_GRAPH_DEFAULT`
11+
* :data:`~.cluster.EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT`
12+
* :data:`~.cluster.EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT`
1313

1414
See :doc:`getting_started` and :doc:`execution_profiles`
1515
for more detail on working with profiles.

0 commit comments

Comments
 (0)