Skip to main content

Logo

CircleCI CodeQL Docs Coverage Status Last commit

PyPI version badge Python versions badge

License Code style: black Downloads

Python-Arango

Python driver for ArangoDB, a scalable multi-model database natively supporting documents, graphs and search.

If you're interested in using asyncio, please check python-arango-async.

Requirements

  • ArangoDB version 3.11+
  • Python version 3.10+

Installation

pip install python-arango --upgrade

Getting Started

Here is a simple usage example:

from arango import ArangoClient

# Initialize the client for ArangoDB.
client = ArangoClient(hosts="http://localhost:8529")

# Connect to "_system" database as root user.
sys_db = client.db("_system", username="root", password="passwd")

# Create a new database named "test".
sys_db.create_database("test")

# Connect to "test" database as root user.
db = client.db("test", username="root", password="passwd")

# Create a new collection named "students".
students = db.create_collection("students")

# Add a persistent index to the collection.
students.add_index({'type': 'persistent', 'fields': ['name'], 'unique': True})

# Insert new documents into the collection.
students.insert({"name": "jane", "age": 39})
students.insert({"name": "josh", "age": 18})
students.insert({"name": "judy", "age": 21})

# Execute an AQL query and iterate through the result cursor.
cursor = db.aql.execute("FOR doc IN students RETURN doc")
student_names = [document["name"] for document in cursor]

Another example with graphs:

from arango import ArangoClient

# Initialize the client for ArangoDB.
client = ArangoClient(hosts="http://localhost:8529")

# Connect to "test" database as root user.
db = client.db("test", username="root", password="passwd")

# Create a new graph named "school".
graph = db.create_graph("school")

# Create a new EnterpriseGraph [Enterprise Edition]
eegraph = db.create_graph(
    name="school",
    smart=True)

# Create vertex collections for the graph.
students = graph.create_vertex_collection("students")
lectures = graph.create_vertex_collection("lectures")

# Create an edge definition (relation) for the graph.
edges = graph.create_edge_definition(
    edge_collection="register",
    from_vertex_collections=["students"],
    to_vertex_collections=["lectures"]
)

# Insert vertex documents into "students" (from) vertex collection.
students.insert({"_key": "01", "full_name": "Anna Smith"})
students.insert({"_key": "02", "full_name": "Jake Clark"})
students.insert({"_key": "03", "full_name": "Lisa Jones"})

# Insert vertex documents into "lectures" (to) vertex collection.
lectures.insert({"_key": "MAT101", "title": "Calculus"})
lectures.insert({"_key": "STA101", "title": "Statistics"})
lectures.insert({"_key": "CSC101", "title": "Algorithms"})

# Insert edge documents into "register" edge collection.
edges.insert({"_from": "students/01", "_to": "lectures/MAT101"})
edges.insert({"_from": "students/01", "_to": "lectures/STA101"})
edges.insert({"_from": "students/01", "_to": "lectures/CSC101"})
edges.insert({"_from": "students/02", "_to": "lectures/MAT101"})
edges.insert({"_from": "students/02", "_to": "lectures/STA101"})
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 { order: 'bfs', uniqueVertices: 'global' }
    RETURN {vertex: v, edge: e, path: p}
    """
cursor = db.aql.execute(query)

Please see the documentation for more details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_arango-8.3.5.tar.gz (157.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_arango-8.3.5-py3-none-any.whl (116.8 kB view details)

Uploaded Python 3

File details

Details for the file python_arango-8.3.5.tar.gz.

File metadata

  • Download URL: python_arango-8.3.5.tar.gz
  • Upload date:
  • Size: 157.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for python_arango-8.3.5.tar.gz
Algorithm Hash digest
SHA256 28934f30c3e1de7419587bbcc0cbcda44684cc8d0f5e8027e85174aa6bedd07f
MD5 bcfc1d49f1228e62853ef58d8aaec04d
BLAKE2b-256 943a3483c0429ae17bca74258b2df8c6bb3e56c05e55e2e1fd1233e84ead8e68

See more details on using hashes here.

File details

Details for the file python_arango-8.3.5-py3-none-any.whl.

File metadata

  • Download URL: python_arango-8.3.5-py3-none-any.whl
  • Upload date:
  • Size: 116.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for python_arango-8.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9cef1096cc6dd5b3e8d336955e35bf33756b2d7ced2d3319aa8bbe41eeccb599
MD5 e4e5a29ed4c98d3a81ef9721a811f4e7
BLAKE2b-256 a13811bed20a1d2b82f3b3cc88302b470025c0b885ec193fcdb661b353de7a09

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

8.3.5 This release

2 files

8.3.4

2 files

8.3.3

2 files

8.3.2

2 files

8.3.1

2 files

8.3.0

2 files

8.2.6

2 files

8.2.5

2 files

8.2.4

2 files

8.2.3

2 files

8.2.2

2 files

8.2.1

2 files

8.2.0

2 files

8.1.7

2 files

8.1.6

2 files

8.1.5

2 files

8.1.4

2 files

8.1.3

2 files

8.1.2

2 files

8.1.1

2 files

8.1.0

2 files

8.0.0

2 files

7.9.1

2 files

7.9.0

2 files

7.8.1

2 files

7.8.0

2 files

7.7.0

2 files

7.6.2

2 files

7.6.1

2 files

7.6.0

2 files

7.5.9

2 files

7.5.8

2 files

7.5.7

2 files

7.5.6

2 files

7.5.5

2 files

7.5.4

2 files

7.5.3

2 files

7.5.2

2 files

7.5.1

2 files

7.5.0

2 files

7.4.1

2 files

7.4.0

2 files

7.3.4

2 files

7.3.3

2 files

7.3.2

2 files

7.3.1

2 files

7.3.0

2 files

7.2.0

2 files

7.1.0

2 files

7.0.1

2 files

7.0.0

2 files

6.1.0

2 files

6.0.0

1 file

5.4.0

1 file

5.3.0

1 file

5.2.1

1 file

5.2.0

1 file

5.1.0

1 file

5.0.0

1 file

4.4.0

1 file

4.3.0

1 file

4.2.1

1 file

4.2.0

1 file

4.1.0

1 file

4.0.1

1 file

4.0.0

1 file

3.12.1

1 file

3.11.0

1 file

3.10.1

1 file

3.10.0

1 file

3.9.0

1 file

3.8.0

1 file

3.7.0

1 file

3.6.0

1 file

3.5.0

1 file

3.4.1

1 file

3.4.0

1 file

3.3.0

1 file

3.2.2

1 file

3.2.0

1 file

3.1.0

1 file

3.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page