Flask-PynamoDB is an extension for integrating with PynamoDB
Project description
Flask-PynamoDB
Flask-PynamoDB is an externsion for Flask that integrates with DynamoDB using the powerful PynamoDB library.
Flask-PynamoDB simplfies the configuration of PynamoDB for your application, as well as adds utilities for better integration with PynamoDB.
Installation
You can install & update the library using pip:
python -m pip install -U Flask-PynamoDB
or:
pip install -U Flask-PynamoDB
Quickstart
from uuid import uuid4
from typing import List
from flask import Flask, render_template
from flask_pynamodb import PynamoDB
from pynamodb.attributes import BooleanAttribute, UnicodeAttribute
class Config:
DYNAMODB_HOST = "http://localhost:8000"
DYNAMODB_AWS_ACCESS_KEY_ID = "test"
DYNAMODB_AWS_SECRET_ACCESS_KEY = "test"
DYNAMODB_READ_CAPACITY_UNITS = 10
DYNAMODB_WRITE_CAPACITY_UNITS = 10
app = Flask(__name__)
app.config.from_object(Config)
db = PynamoDB(app)
class Todo(db.Model):
class Meta:
table_name = "todo"
id = UnicodeAttribute(hash_key=True)
name = UnicodeAttribute()
description = UnicodeAttribute()
done = BooleanAttribute(default=False)
@app.route("/")
def index() -> List[str]:
return [todo.name for i in Todo.scan()]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Flask-PynamoDB-0.0.1.tar.gz
(4.2 kB
view details)
File details
Details for the file Flask-PynamoDB-0.0.1.tar.gz
.
File metadata
- Download URL: Flask-PynamoDB-0.0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320525743d9ed4381dbf01cb1fd933147f4c095046bc42cc092afc291445a5c3 |
|
MD5 | ab7d353362ab5c8f79ebe1a1f10de736 |
|
BLAKE2b-256 | 784ad4dcb485f9dcea0ce2f9c324f2bc7144ffb11556facf46d98c736943af15 |