Python driver for ArangoDB, a scalable multi-model database natively supporting documents, graphs and search.
This is the asyncio alternative of the officially supported python-arango driver.
Note: This project is still in active development, features might be added or removed.
- ArangoDB version 3.11+
- Python version 3.9+
pip install python-arango-async --upgrade
Here is a simple usage example:
from arangoasync import ArangoClient
from arangoasync.auth import Auth
async def main():
# Initialize the client for ArangoDB.
async with ArangoClient(hosts="http://localhost:8529") as client:
auth = Auth(username="root", password="passwd")
# Connect to "_system" database as root user.
sys_db = await client.db("_system", auth=auth)
# Create a new database named "test".
await sys_db.create_database("test")
# Connect to "test" database as root user.
db = await client.db("test", auth=auth)
# Create a new collection named "students".
students = await db.create_collection("students")
# Add a persistent index to the collection.
await students.add_index(type="persistent", fields=["name"], options={"unique": True})
# Insert new documents into the collection.
await students.insert({"name": "jane", "age": 39})
await students.insert({"name": "josh", "age": 18})
await students.insert({"name": "judy", "age": 21})
# Execute an AQL query and iterate through the result cursor.
cursor = await db.aql.execute("FOR doc IN students RETURN doc")
async with cursor:
student_names = []
async for doc in cursor:
student_names.append(doc["name"])
Please see the documentation for more details.