python-arango


Namepython-arango JSON
Version 8.1.1 PyPI version JSON
download
home_pageNone
SummaryPython Driver for ArangoDB
upload_time2024-09-13 07:17:57
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2016-2021 Joohwan Oh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords arangodb python driver
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Logo](https://user-images.githubusercontent.com/2701938/108583516-c3576680-72ee-11eb-883f-2d9b52e74e45.png)

[![CircleCI](https://dl.circleci.com/status-badge/img/gh/arangodb/python-arango/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango/tree/main)
[![CodeQL](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml)
[![Docs](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml)
[![Coverage Status](https://codecov.io/gh/arangodb/python-arango/branch/main/graph/badge.svg?token=M8zrjrzsUY)](https://codecov.io/gh/arangodb/python-arango)
[![Last commit](https://img.shields.io/github/last-commit/arangodb/python-arango)](https://github.com/arangodb/python-arango/commits/master)

[![PyPI version badge](https://img.shields.io/pypi/v/python-arango?color=3775A9&style=for-the-badge&logo=pypi&logoColor=FFD43B)](https://pypi.org/project/python-arango/)
[![Python versions badge](https://img.shields.io/badge/3.8%2B-3776AB?style=for-the-badge&logo=python&logoColor=FFD43B&label=Python)](https://pypi.org/project/python-arango/)

[![License](https://img.shields.io/github/license/arangodb/python-arango?color=9E2165&style=for-the-badge)](https://github.com/arangodb/python-arango/blob/master/LICENSE)
[![Code style: black](https://img.shields.io/static/v1?style=for-the-badge&label=code%20style&message=black&color=black)](https://github.com/psf/black)
[![Downloads](https://img.shields.io/pepy/dt/python-arango?style=for-the-badge&color=282661
)](https://pepy.tech/project/python-arango)

# Python-Arango

Python driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model
database natively supporting documents, graphs and search.

## Requirements

- ArangoDB version 3.11+
- Python version 3.8+

## Installation

```shell
pip install python-arango --upgrade
```

## Getting Started

Here is a simple usage example:

```python
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](https://www.arangodb.com/docs/stable/graphs.html):

```python
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 { bfs: true, uniqueVertices: 'global' }
    RETURN {vertex: v, edge: e, path: p}
    """
cursor = db.aql.execute(query)
```

Please see the [documentation](https://docs.python-arango.com) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-arango",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Joohwan Oh <joohwan.oh@outlook.com>, Alexandru Petenchea <alex.petenchea@gmail.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>",
    "keywords": "arangodb, python, driver",
    "author": null,
    "author_email": "Joohwan Oh <joohwan.oh@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/ac/89/6de3bccb59c8b4f042dc0fb340796810880ba7e7873304aa7245c3fe339b/python_arango-8.1.1.tar.gz",
    "platform": null,
    "description": "![Logo](https://user-images.githubusercontent.com/2701938/108583516-c3576680-72ee-11eb-883f-2d9b52e74e45.png)\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/arangodb/python-arango/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/arangodb/python-arango/tree/main)\n[![CodeQL](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/codeql.yaml)\n[![Docs](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml/badge.svg)](https://github.com/arangodb/python-arango/actions/workflows/docs.yaml)\n[![Coverage Status](https://codecov.io/gh/arangodb/python-arango/branch/main/graph/badge.svg?token=M8zrjrzsUY)](https://codecov.io/gh/arangodb/python-arango)\n[![Last commit](https://img.shields.io/github/last-commit/arangodb/python-arango)](https://github.com/arangodb/python-arango/commits/master)\n\n[![PyPI version badge](https://img.shields.io/pypi/v/python-arango?color=3775A9&style=for-the-badge&logo=pypi&logoColor=FFD43B)](https://pypi.org/project/python-arango/)\n[![Python versions badge](https://img.shields.io/badge/3.8%2B-3776AB?style=for-the-badge&logo=python&logoColor=FFD43B&label=Python)](https://pypi.org/project/python-arango/)\n\n[![License](https://img.shields.io/github/license/arangodb/python-arango?color=9E2165&style=for-the-badge)](https://github.com/arangodb/python-arango/blob/master/LICENSE)\n[![Code style: black](https://img.shields.io/static/v1?style=for-the-badge&label=code%20style&message=black&color=black)](https://github.com/psf/black)\n[![Downloads](https://img.shields.io/pepy/dt/python-arango?style=for-the-badge&color=282661\n)](https://pepy.tech/project/python-arango)\n\n# Python-Arango\n\nPython driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model\ndatabase natively supporting documents, graphs and search.\n\n## Requirements\n\n- ArangoDB version 3.11+\n- Python version 3.8+\n\n## Installation\n\n```shell\npip install python-arango --upgrade\n```\n\n## Getting Started\n\nHere is a simple usage example:\n\n```python\nfrom arango import ArangoClient\n\n# Initialize the client for ArangoDB.\nclient = ArangoClient(hosts=\"http://localhost:8529\")\n\n# Connect to \"_system\" database as root user.\nsys_db = client.db(\"_system\", username=\"root\", password=\"passwd\")\n\n# Create a new database named \"test\".\nsys_db.create_database(\"test\")\n\n# Connect to \"test\" database as root user.\ndb = client.db(\"test\", username=\"root\", password=\"passwd\")\n\n# Create a new collection named \"students\".\nstudents = db.create_collection(\"students\")\n\n# Add a persistent index to the collection.\nstudents.add_index({'type': 'persistent', 'fields': ['name'], 'unique': True})\n\n# Insert new documents into the collection.\nstudents.insert({\"name\": \"jane\", \"age\": 39})\nstudents.insert({\"name\": \"josh\", \"age\": 18})\nstudents.insert({\"name\": \"judy\", \"age\": 21})\n\n# Execute an AQL query and iterate through the result cursor.\ncursor = db.aql.execute(\"FOR doc IN students RETURN doc\")\nstudent_names = [document[\"name\"] for document in cursor]\n```\n\nAnother example with [graphs](https://www.arangodb.com/docs/stable/graphs.html):\n\n```python\nfrom arango import ArangoClient\n\n# Initialize the client for ArangoDB.\nclient = ArangoClient(hosts=\"http://localhost:8529\")\n\n# Connect to \"test\" database as root user.\ndb = client.db(\"test\", username=\"root\", password=\"passwd\")\n\n# Create a new graph named \"school\".\ngraph = db.create_graph(\"school\")\n\n# Create a new EnterpriseGraph [Enterprise Edition]\neegraph = db.create_graph(\n    name=\"school\",\n    smart=True)\n\n# Create vertex collections for the graph.\nstudents = graph.create_vertex_collection(\"students\")\nlectures = graph.create_vertex_collection(\"lectures\")\n\n# Create an edge definition (relation) for the graph.\nedges = 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.\nstudents.insert({\"_key\": \"01\", \"full_name\": \"Anna Smith\"})\nstudents.insert({\"_key\": \"02\", \"full_name\": \"Jake Clark\"})\nstudents.insert({\"_key\": \"03\", \"full_name\": \"Lisa Jones\"})\n\n# Insert vertex documents into \"lectures\" (to) vertex collection.\nlectures.insert({\"_key\": \"MAT101\", \"title\": \"Calculus\"})\nlectures.insert({\"_key\": \"STA101\", \"title\": \"Statistics\"})\nlectures.insert({\"_key\": \"CSC101\", \"title\": \"Algorithms\"})\n\n# Insert edge documents into \"register\" edge collection.\nedges.insert({\"_from\": \"students/01\", \"_to\": \"lectures/MAT101\"})\nedges.insert({\"_from\": \"students/01\", \"_to\": \"lectures/STA101\"})\nedges.insert({\"_from\": \"students/01\", \"_to\": \"lectures/CSC101\"})\nedges.insert({\"_from\": \"students/02\", \"_to\": \"lectures/MAT101\"})\nedges.insert({\"_from\": \"students/02\", \"_to\": \"lectures/STA101\"})\nedges.insert({\"_from\": \"students/03\", \"_to\": \"lectures/CSC101\"})\n\n# Traverse the graph in outbound direction, breath-first.\nquery = \"\"\"\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    \"\"\"\ncursor = db.aql.execute(query)\n```\n\nPlease see the [documentation](https://docs.python-arango.com) for more details.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2016-2021 Joohwan Oh  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Python Driver for ArangoDB",
    "version": "8.1.1",
    "project_urls": {
        "homepage": "https://github.com/arangodb/python-arango"
    },
    "split_keywords": [
        "arangodb",
        " python",
        " driver"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfa725174bde9560fadcc7d3504070d542fc58e608390f22d0487a715f5b2923",
                "md5": "845deb52d6ca46ebe08c6f3b4f1b5087",
                "sha256": "e1e61a042a927f2e9f19e785becdd8e7f03bbba0a128073046af2d6446c1b7e0"
            },
            "downloads": -1,
            "filename": "python_arango-8.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "845deb52d6ca46ebe08c6f3b4f1b5087",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 116106,
            "upload_time": "2024-09-13T07:17:55",
            "upload_time_iso_8601": "2024-09-13T07:17:55.786519Z",
            "url": "https://files.pythonhosted.org/packages/df/a7/25174bde9560fadcc7d3504070d542fc58e608390f22d0487a715f5b2923/python_arango-8.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac896de3bccb59c8b4f042dc0fb340796810880ba7e7873304aa7245c3fe339b",
                "md5": "f76864e06f83637f635ec4d3da44fe3c",
                "sha256": "9496d66798c0be76c2f59792ab2a1cea88ff1266bed6f51505d08d4095941b01"
            },
            "downloads": -1,
            "filename": "python_arango-8.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f76864e06f83637f635ec4d3da44fe3c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 154432,
            "upload_time": "2024-09-13T07:17:57",
            "upload_time_iso_8601": "2024-09-13T07:17:57.500265Z",
            "url": "https://files.pythonhosted.org/packages/ac/89/6de3bccb59c8b4f042dc0fb340796810880ba7e7873304aa7245c3fe339b/python_arango-8.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-13 07:17:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "arangodb",
    "github_project": "python-arango",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "lcname": "python-arango"
}
        
Elapsed time: 0.36483s