Skip to content

Commit 0ca6478

Browse files
committed
Update documentation and README
1 parent e9b6d2b commit 0ca6478

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

README.rst

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,50 @@ Here is a simple usage example:
109109
result = db.aql.execute('FOR s IN students RETURN s')
110110
print([student['name'] for student in result])
111111
112+
113+
Here is another example involving graphs:
114+
115+
.. code-block:: python
116+
117+
from arango import ArangoClient
118+
119+
client = ArangoClient()
120+
121+
# Create a new graph
122+
graph = client.db('my_database').create_graph('my_graph')
123+
students = graph.create_vertex_collection('students')
124+
courses = graph.create_vertex_collection('courses')
125+
takes = graph.create_edge_definition(
126+
name='takes',
127+
from_collections=['students'],
128+
to_collections=['courses']
129+
)
130+
131+
# Insert vertices
132+
students.insert({'_key': '01', 'full_name': 'Anna Smith'})
133+
students.insert({'_key': '02', 'full_name': 'Jake Clark'})
134+
students.insert({'_key': '03', 'full_name': 'Lisa Jones'})
135+
136+
courses.insert({'_key': 'MAT101', 'title': 'Calculus'})
137+
courses.insert({'_key': 'STA101', 'title': 'Statistics'})
138+
courses.insert({'_key': 'CSC101', 'title': 'Algorithms'})
139+
140+
# Insert edges
141+
takes.insert({'_from': 'students/01', '_to': 'courses/MAT101'})
142+
takes.insert({'_from': 'students/01', '_to': 'courses/STA101'})
143+
takes.insert({'_from': 'students/01', '_to': 'courses/CSC101'})
144+
takes.insert({'_from': 'students/02', '_to': 'courses/MAT101'})
145+
takes.insert({'_from': 'students/02', '_to': 'courses/STA101'})
146+
takes.insert({'_from': 'students/03', '_to': 'courses/CSC101'})
147+
148+
# Traverse the graph in outbound direction, breath-first
149+
traversal_results = graph.traverse(
150+
start_vertex='students/01',
151+
strategy='bfs',
152+
direction='outbound'
153+
)
154+
print(traversal_results['vertices'])
155+
112156
Please read the full `API documentation`_ for more details!
113157

114158
.. _API documentation:

arango/batch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ def commit(self):
154154
self._batch_jobs = []
155155

156156
def clear(self):
157-
"""Clear the API requests queue and discard any batch job pointers.
157+
"""Clear the requests queue and discard pointers to batch jobs issued.
158158
159-
:returns: the number of API requests and batch job pointers discarded
159+
:returns: the number of requests (and batch job pointers) discarded
160160
:rtype: int
161161
162162
.. warning::
163-
This method will orphan any batch jobs that were issues
163+
This method will orphan any batch jobs that were issued
164164
"""
165165
count = len(self._requests)
166166
self._requests = []

0 commit comments

Comments
 (0)