
[](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango-async/tree/main)
[](https://github.com/arangodb/python-arango-async/actions/workflows/codeql.yaml)
[](https://github.com/arangodb/python-arango-async/commits/main)
[](https://pypi.org/project/python-arango-async/)
[](https://pypi.org/project/python-arango-async/)
[](https://github.com/arangodb/python-arango/blob/main/LICENSE)
[](https://github.com/psf/black)
[](https://pepy.tech/project/python-arango-async)
# python-arango-async
Python driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model
database natively supporting documents, graphs and search.
This is the _asyncio_ alternative of the [python-arango](https://github.com/arangodb/python-arango)
driver.
Check out a demo app at [python-arango-async-demo](https://github.com/apetenchea/python-arango-async-demo).
## Requirements
- ArangoDB version 3.11+
- Python version 3.10+
## Installation
```shell
pip install python-arango-async --upgrade
```
## Getting Started
Here is a simple usage example:
```python
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"])
```
Another example with [graphs](https://docs.arangodb.com/stable/graphs/):
```python
async def main():
from arangoasync import ArangoClient
from arangoasync.auth import Auth
# Initialize the client for ArangoDB.
async with ArangoClient(hosts="http://localhost:8529") as client:
auth = Auth(username="root", password="passwd")
# Connect to "test" database as root user.
db = await client.db("test", auth=auth)
# Get the API wrapper for graph "school".
if await db.has_graph("school"):
graph = db.graph("school")
else:
graph = await db.create_graph("school")
# Create vertex collections for the graph.
students = await graph.create_vertex_collection("students")
lectures = await graph.create_vertex_collection("lectures")
# Create an edge definition (relation) for the graph.
edges = await graph.create_edge_definition(
edge_collection="register",
from_vertex_collections=["students"],
to_vertex_collections=["lectures"]
)
# Insert vertex documents into "students" (from) vertex collection.
await students.insert({"_key": "01", "full_name": "Anna Smith"})
await students.insert({"_key": "02", "full_name": "Jake Clark"})
await students.insert({"_key": "03", "full_name": "Lisa Jones"})
# Insert vertex documents into "lectures" (to) vertex collection.
await lectures.insert({"_key": "MAT101", "title": "Calculus"})
await lectures.insert({"_key": "STA101", "title": "Statistics"})
await lectures.insert({"_key": "CSC101", "title": "Algorithms"})
# Insert edge documents into "register" edge collection.
await edges.insert({"_from": "students/01", "_to": "lectures/MAT101"})
await edges.insert({"_from": "students/01", "_to": "lectures/STA101"})
await edges.insert({"_from": "students/01", "_to": "lectures/CSC101"})
await edges.insert({"_from": "students/02", "_to": "lectures/MAT101"})
await edges.insert({"_from": "students/02", "_to": "lectures/STA101"})
await edges.insert({"_from": "students/03", "_to": "lectures/CSC101"})
# Traverse the graph in outbound direction, breath-first.
query = """
FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'
OPTIONS { bfs: true, uniqueVertices: 'global' }
RETURN {vertex: v, edge: e, path: p}
"""
async with await db.aql.execute(query) as cursor:
async for doc in cursor:
print(doc)
```
Please see the [documentation](https://python-arango-async.readthedocs.io/en/latest/) for more details.
Raw data
{
"_id": null,
"home_page": null,
"name": "python-arango-async",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>",
"keywords": "arangodb, python, driver, async",
"author": null,
"author_email": "Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>",
"download_url": "https://files.pythonhosted.org/packages/1e/7d/3ce8ef404e88f228bc730925f4153d068ba052c09e1512c60569856634ac/python_arango_async-1.0.2.tar.gz",
"platform": null,
"description": "\n\n[](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango-async/tree/main)\n[](https://github.com/arangodb/python-arango-async/actions/workflows/codeql.yaml)\n[](https://github.com/arangodb/python-arango-async/commits/main)\n\n[](https://pypi.org/project/python-arango-async/)\n[](https://pypi.org/project/python-arango-async/)\n\n[](https://github.com/arangodb/python-arango/blob/main/LICENSE)\n[](https://github.com/psf/black)\n[](https://pepy.tech/project/python-arango-async)\n\n# python-arango-async\n\nPython driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model\ndatabase natively supporting documents, graphs and search.\n\nThis is the _asyncio_ alternative of the [python-arango](https://github.com/arangodb/python-arango)\ndriver.\n\nCheck out a demo app at [python-arango-async-demo](https://github.com/apetenchea/python-arango-async-demo).\n\n## Requirements\n\n- ArangoDB version 3.11+\n- Python version 3.10+\n\n## Installation\n\n```shell\npip install python-arango-async --upgrade\n```\n\n## Getting Started\n\nHere is a simple usage example:\n\n```python\nfrom arangoasync import ArangoClient\nfrom arangoasync.auth import Auth\n\n\nasync def main():\n # Initialize the client for ArangoDB.\n async with ArangoClient(hosts=\"http://localhost:8529\") as client:\n auth = Auth(username=\"root\", password=\"passwd\")\n\n # Connect to \"_system\" database as root user.\n sys_db = await client.db(\"_system\", auth=auth)\n\n # Create a new database named \"test\".\n await sys_db.create_database(\"test\")\n\n # Connect to \"test\" database as root user.\n db = await client.db(\"test\", auth=auth)\n\n # Create a new collection named \"students\".\n students = await db.create_collection(\"students\")\n\n # Add a persistent index to the collection.\n await students.add_index(type=\"persistent\", fields=[\"name\"], options={\"unique\": True})\n\n # Insert new documents into the collection.\n await students.insert({\"name\": \"jane\", \"age\": 39})\n await students.insert({\"name\": \"josh\", \"age\": 18})\n await students.insert({\"name\": \"judy\", \"age\": 21})\n\n # Execute an AQL query and iterate through the result cursor.\n cursor = await db.aql.execute(\"FOR doc IN students RETURN doc\")\n async with cursor:\n student_names = []\n async for doc in cursor:\n student_names.append(doc[\"name\"])\n```\n\nAnother example with [graphs](https://docs.arangodb.com/stable/graphs/):\n\n```python\nasync def main():\n from arangoasync import ArangoClient\n from arangoasync.auth import Auth\n\n # Initialize the client for ArangoDB.\n async with ArangoClient(hosts=\"http://localhost:8529\") as client:\n auth = Auth(username=\"root\", password=\"passwd\")\n\n # Connect to \"test\" database as root user.\n db = await client.db(\"test\", auth=auth)\n\n # Get the API wrapper for graph \"school\".\n if await db.has_graph(\"school\"):\n graph = db.graph(\"school\")\n else:\n graph = await db.create_graph(\"school\")\n\n # Create vertex collections for the graph.\n students = await graph.create_vertex_collection(\"students\")\n lectures = await graph.create_vertex_collection(\"lectures\")\n\n # Create an edge definition (relation) for the graph.\n edges = await graph.create_edge_definition(\n edge_collection=\"register\",\n from_vertex_collections=[\"students\"],\n to_vertex_collections=[\"lectures\"]\n )\n\n # Insert vertex documents into \"students\" (from) vertex collection.\n await students.insert({\"_key\": \"01\", \"full_name\": \"Anna Smith\"})\n await students.insert({\"_key\": \"02\", \"full_name\": \"Jake Clark\"})\n await students.insert({\"_key\": \"03\", \"full_name\": \"Lisa Jones\"})\n\n # Insert vertex documents into \"lectures\" (to) vertex collection.\n await lectures.insert({\"_key\": \"MAT101\", \"title\": \"Calculus\"})\n await lectures.insert({\"_key\": \"STA101\", \"title\": \"Statistics\"})\n await lectures.insert({\"_key\": \"CSC101\", \"title\": \"Algorithms\"})\n\n # Insert edge documents into \"register\" edge collection.\n await edges.insert({\"_from\": \"students/01\", \"_to\": \"lectures/MAT101\"})\n await edges.insert({\"_from\": \"students/01\", \"_to\": \"lectures/STA101\"})\n await edges.insert({\"_from\": \"students/01\", \"_to\": \"lectures/CSC101\"})\n await edges.insert({\"_from\": \"students/02\", \"_to\": \"lectures/MAT101\"})\n await edges.insert({\"_from\": \"students/02\", \"_to\": \"lectures/STA101\"})\n await edges.insert({\"_from\": \"students/03\", \"_to\": \"lectures/CSC101\"})\n\n # Traverse the graph in outbound direction, breath-first.\n query = \"\"\"\n FOR v, e, p IN 1..3 OUTBOUND 'students/01' GRAPH 'school'\n OPTIONS { bfs: true, uniqueVertices: 'global' }\n RETURN {vertex: v, edge: e, path: p}\n \"\"\"\n\n async with await db.aql.execute(query) as cursor:\n async for doc in cursor:\n print(doc)\n```\n\nPlease see the [documentation](https://python-arango-async.readthedocs.io/en/latest/) for more details.\n",
"bugtrack_url": null,
"license": null,
"summary": "Async Python Driver for ArangoDB",
"version": "1.0.2",
"project_urls": {
"homepage": "https://github.com/arangodb/python-arango-async"
},
"split_keywords": [
"arangodb",
" python",
" driver",
" async"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7babd0fec3cc7865193a011699adeb94bd8a039495ce015c135a7add41cfcac8",
"md5": "85b7086483bdff3eaa0952c817eddfee",
"sha256": "e856267590e873aecd5748fc48d74a600db3a37a9c104956cb2c96c63fe6005f"
},
"downloads": -1,
"filename": "python_arango_async-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "85b7086483bdff3eaa0952c817eddfee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 100859,
"upload_time": "2025-08-18T07:25:45",
"upload_time_iso_8601": "2025-08-18T07:25:45.283955Z",
"url": "https://files.pythonhosted.org/packages/7b/ab/d0fec3cc7865193a011699adeb94bd8a039495ce015c135a7add41cfcac8/python_arango_async-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1e7d3ce8ef404e88f228bc730925f4153d068ba052c09e1512c60569856634ac",
"md5": "261bd16e1639d44e4a59178ad8fc7152",
"sha256": "0eb7ae90908c5d01006dcb9c05660bdba812206b290bab5b385d0876875c9d39"
},
"downloads": -1,
"filename": "python_arango_async-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "261bd16e1639d44e4a59178ad8fc7152",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 256542,
"upload_time": "2025-08-18T07:25:47",
"upload_time_iso_8601": "2025-08-18T07:25:47.018969Z",
"url": "https://files.pythonhosted.org/packages/1e/7d/3ce8ef404e88f228bc730925f4153d068ba052c09e1512c60569856634ac/python_arango_async-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-18 07:25:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "arangodb",
"github_project": "python-arango-async",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"circle": true,
"lcname": "python-arango-async"
}