Skip to content

Commit fd8b856

Browse files
author
Joohwan Oh
committed
Update README.md
1 parent eadeb66 commit fd8b856

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,32 @@ Installation
2424

2525
- Stable
2626

27-
~~~~ {.sourceCode .bash}
27+
```bash
2828
sudo pip install py-arango
29-
~~~~
29+
```
3030

3131
- Latest
3232

33-
~~~~ {.sourceCode .bash}
33+
```bash
3434
git clone https://github.com/Joowani/py-arango.git
3535
cd py-arango
3636
python2.7 setup.py install
37-
~~~~
37+
```
3838

3939
Initializing Connection
4040
-----------------------
4141

42-
~~~~ {.sourceCode .python}
42+
```python
4343
from arango import Arango
4444

4545
# Initialize ArangoDB connection
4646
a = Arango(host="localhost", port=8529)
47-
~~~~
47+
```
4848

4949
Databases
5050
---------
5151

52-
~~~~ {.sourceCode .python}
52+
```python
5353
# List the database names
5454
a.databases
5555
a.databases["user"]
@@ -83,12 +83,12 @@ a.{whatever}
8383
a.db("my_db").add_collection("my_col")
8484
a.db("my_db").col("my_col").add_document({"value": 1})
8585
a.db("my_db").{whatever}
86-
~~~~
86+
```
8787

8888
AQL Functions
8989
-------------
9090

91-
~~~~ {.sourceCode .python}
91+
```python
9292
my_db = a.db("my_db")
9393

9494
# List the AQL functions defined in database "my_db"
@@ -102,12 +102,12 @@ my_db.add_aql_function(
102102

103103
# Remove an AQL function
104104
my_db.remove_aql_function("myfunctions::temperature::ctof")
105-
~~~~
105+
```
106106

107107
AQL Queries
108108
-----------
109109

110-
~~~~ {.sourceCode .python}
110+
```python
111111
# Retrieve the execution plan without actually executing it
112112
my_db.explain_query("FOR doc IN my_col RETURN doc")
113113

@@ -121,12 +121,12 @@ cursor = my_db.execute_query(
121121
)
122122
for doc in cursor: # the cursor is deleted when the generator is exhausted
123123
print doc
124-
~~~~
124+
```
125125

126126
Collections
127127
-----------
128128

129-
~~~~ {.sourceCode .python}
129+
```python
130130
my_db = a.db("my_db")
131131

132132
# List the collection names in "my_db"
@@ -184,12 +184,12 @@ my_col.truncate()
184184
# Check if a document exists in the collection
185185
my_col.contains("a_document_key")
186186
"a_document_key" in my_col
187-
~~~~
187+
```
188188

189189
Indexes
190190
-------
191191

192-
~~~~ {.sourceCode .python}
192+
```python
193193
my_col = a.collection("my_col") # or a.col("mycol")
194194

195195
# List the indexes in collection "my_col"
@@ -210,12 +210,12 @@ my_col.add_geo_index(fields=["longitude", "latitude"])
210210

211211
# Add a fulltext index on attribute "attr1"
212212
my_col.add_fulltext_index(fields=["attr1"], min_length=10)
213-
~~~~
213+
```
214214

215215
Documents
216216
---------
217217

218-
~~~~ {.sourceCode .python}
218+
```python
219219
my_col = a.db("my_db").collection("my_col")
220220

221221
# Retrieve a document by its key
@@ -237,12 +237,12 @@ my_col.remove_document("doc01")
237237
for doc in my_col:
238238
new_value = doc["value"] + 1
239239
my_col.update_document(doc["_key"], {"new_value": new_value})
240-
~~~~
240+
```
241241

242242
Simple Queries (Collection-Specific)
243243
------------------------------------
244244

245-
~~~~ {.sourceCode .python}
245+
```python
246246
# Return the first 5 documents in collection "my_col"
247247
my_col.first(5)
248248

@@ -272,12 +272,12 @@ my_col.within(latitude=100, longitude=20, radius=15)
272272

273273
# Return all documents near a given coordinate (requires geo-index)
274274
my_col.near(latitude=100, longitude=20)
275-
~~~~
275+
```
276276

277277
Graphs
278278
------
279279

280-
~~~~ {.sourceCode .python}
280+
```python
281281
my_db = a.db("my_db")
282282

283283
# List all the graphs in the database
@@ -307,12 +307,12 @@ my_graph.revision
307307
my_graph.edge_definitions
308308
my_graph.vertex_collections
309309
my_graph.orphan_collections
310-
~~~~
310+
```
311311

312312
Vertices
313313
--------
314314

315-
~~~~ {.sourceCode .python}
315+
```python
316316
# Add new vertices (again if "_key" is not given it's auto-generated)
317317
my_graph.add_vertex("vcol01", {"_key": "v01", "value": 1})
318318
my_graph.add_vertex("vcol02", {"_key": "v01", "value": 1})
@@ -325,12 +325,12 @@ my_graph.update_vertex("vol02/v01", {"new_value": 3})
325325

326326
# Remove a vertex
327327
my_graph.remove_vertex("vol01/v01")
328-
~~~~
328+
```
329329

330330
Edges
331331
-----
332332

333-
~~~~ {.sourceCode .python}
333+
```python
334334
# Add a new edge
335335
my_graph.add_edge(
336336
"ecol01", # edge collection name
@@ -351,12 +351,12 @@ my_graph.update_edge("ecol01/e01", {"foo": 3})
351351

352352
# Remove an edge
353353
my_graph.remove_edge("ecol01/e01")
354-
~~~~
354+
```
355355

356356
Graph Traversals
357357
----------------
358358

359-
~~~~ {.sourceCode .python}
359+
```python
360360
my_graph = a.db("my_db").graph("my_graph")
361361

362362
# Execute a graph traversal
@@ -371,12 +371,12 @@ results.get("visited")
371371

372372
# Return the paths traversed in order
373373
results.get("paths")
374-
~~~~
374+
```
375375

376376
Batch Requests
377377
--------------
378378

379-
~~~~ {.sourceCode .python}
379+
```python
380380
# NOTE: only (add/update/replace/remove) methods for (documents/vertices/edges) are supported at the moment
381381

382382
# Execute a batch request for managing documents
@@ -426,12 +426,12 @@ self.db.execute_batch([
426426
{"wait_for_sync": True}
427427
),
428428
])
429-
~~~~
429+
```
430430

431431
Transactions
432432
------------
433433

434-
~~~~ {.sourceCode .python}
434+
```python
435435
# Execute a transaction
436436
action = """
437437
function () {
@@ -448,7 +448,7 @@ res = my_db.execute_transaction(
448448
wait_for_sync=True,
449449
lock_timeout=10000
450450
)
451-
~~~~
451+
```
452452

453453
To Do
454454
-----
@@ -465,6 +465,6 @@ To Do
465465
Running Tests (requires ArangoDB on localhost)
466466
----------------------------------------------
467467

468-
~~~~ {.sourceCode .bash}
468+
```bash
469469
nosetests
470-
~~~~
470+
```

0 commit comments

Comments
 (0)