Welcome to the GitHub page for python-arango, a Python driver for ArangoDB's REST API.
- Clean, Pythonic interface
- Lightweight
- 95%+ API coverage
- Python versions 2.7.x, 3.4.x and 3.5.x are supported
- Latest version of python-arango (3.x) supports ArangoDB 3.x only
- Older versions of python-arango (2.x) support ArangoDB 2.x only
To install a stable version from PyPi:
pip install python-arangoTo install the latest version directly from GitHub:
git clone https://github.com/joowani/python-arango.git
cd python-arango
python setup.py installYou may need to use sudo depending on your environment.
Here is simple usage example:
from arango import ArangoClient
# Initialize the client for ArangoDB
client = ArangoClient(
protocol='http',
host="localhost",
port=8529,
username='root',
password='',
enable_logging=True
)
# Create a new database named "my_database"
db = client.create_database('my_database')
# Create a new collection named "students"
students = db.create_collection('students')
# Add a hash index to the collection
students.add_hash_index(fields=['name'], unique=True)
# Insert new documents into the collection
students.insert({'name': 'jane', 'age': 19})
students.insert({'name': 'josh', 'age': 13})
students.insert({'name': 'jake', 'age': 21})
# Execute an AQL query and iterate through the result cursor
cursor = db.aql.execute('FOR s IN students RETURN s')
print(student['name'] for student in cursor)Please read the full API documentation for more details!
