Skip to main content

Async Python Driver for ArangoDB

Project description

Logo

CircleCI CodeQL Last commit

PyPI version badge Python versions badge

License Code style: black Downloads

python-arango-async

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.

Requirements

  • ArangoDB version 3.11+
  • Python version 3.9+

Installation

pip install python-arango-async --upgrade

Getting Started

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.

Project 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_async-0.0.2.tar.gz (194.4 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_async-0.0.2-py3-none-any.whl (67.4 kB view details)

Uploaded Python 3

File details

Details for the file python_arango_async-0.0.2.tar.gz.

File metadata

  • Download URL: python_arango_async-0.0.2.tar.gz
  • Upload date:
  • Size: 194.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for python_arango_async-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2e383056646611ef0749199f90996cbb033ba125800f51542ee92f5e72480b2c
MD5 ddc49c9b7b7b5a8c833e56bd73e7cdbb
BLAKE2b-256 99f578a6fb1f2b0387b875465e7eeaf7c2b734589114a08425962202d66aba6f

See more details on using hashes here.

File details

Details for the file python_arango_async-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_arango_async-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f49925e4fcc65aecc571c61a9d4930ffeb64e76648c07a2ffbe2be246947c085
MD5 245df004d2564020eb2deb3e2d8d661e
BLAKE2b-256 dd833077c593f491c10f7bfbd519fd024c492a22169a9c0c211a3d799116a896

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page