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])
Links
[python-arango documentation](http://python-driver-for-arangodb.readthedocs.io/en/master/intro.html)
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.1.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for Flask_Arangodb-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a2593644d7619a45155c0656bdfa1e08208fbf1d8d71ffddd89e97646504ef |
|
MD5 | 783285659c37ec7057a7860f6bbe7b74 |
|
BLAKE2b-256 | 3829968bbf2cdcfa6dfca3a248960e9930ccb74a3dd8e045ba3eaec76109c382 |