Skip to main content

Flask extension for ArangoDB using python-arango

Project description

This is Flask extension for integration ArangoDB using python-arango. It’s inspired by Flask-Arango, an extension for the pyArango library.

Usage

Install using pip:

pip install flask-arangodb

Example

Typical usage looks like this:

from flask import Flask

from flask_arangodb import ArangoDB

# Configuration
ARANGO_SETTINGS = {'host': 'localhost', 'port': 8529}
ARANGO_DB = 'mydatabase'

app = Flask(__name__)
app.config.from_object(__name__)
arango = ArangoDB(app)

@app.route('/')
def index():
    # refer to python-arango for more information

    # Set up some test data to query against
    arango.db.collection('students').insert_many([
        {'_key': 'Abby', 'age': 22},
        {'_key': 'John', 'age': 18},
        {'_key': 'Mary', 'age': 21}
    ])

    # Execute the query
    cursor = db.aql.execute(
        'FOR s IN students FILTER s.age < @value RETURN s',
        bind_vars={'value': 19}
    )

    # Iterate through the result cursor
    return([student['_key'] for student in cursor])

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

Flask-Arangodb-1.0.2.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

Flask_Arangodb-1.0.2-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

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