A Dynamodb ORM
Project description
Quickstart
# Setup the db singleton
import boto3
from cerami import Cerami
dynamodb = boto3.client('dynamodb')
db = Cerami(dynamodb)
# create classes
import uuid
from cerami.datatype import String, Set, Datetime
from cerami.decorators import primary_key
@primary_key('_id', 'title')
class Book(db.Model):
__tablename__ = "Books"
_id = String(default=uuid.uuid4)
title = String()
authors = Set(String())
publisher = String()
book_producer = String()
tags = Set(String())
published = Datetime()
rights = String()
identifiers = String()
comments = String()
# Query
Book.scan\
.filter(Book.title.eq("Zac's First Book"))\
.filter(Book.comments.eq("Awesome"))\
.execute()
Book.query\
.key(Book._id.eq("XXX"))\
.filter(Book.comments.eq("YYY"))\
.execute()
Book.get\
.key(Book.Schema._id.eq("XXX"))\
.key(Book.Schema.title.eq("ZZZ"))\
.execute()
Setup Dynamodb / boto3
You need to install the aws2 cli and have dynamo db running locally. Dynamodb requires java to run locally as well so good luck if you dont have it. Try these steps first and see how it goes.
Download DynamoDB Locally
- Download DynamoDB Locally
- Unzip/Untar the content
- Move to somewhere you wont lose it.
Download the AWS2 CLI
- Download the AWS2 CLI
- Follow the install instructions
Configure the AWS2 CLI
In order to run DynamoDB locally, you need to configure the cli as such:
aws2 configure
AWS Access Key ID: "fakeMyKeyId"
AWS Secret Access Key: "fakeSecretAccessKey"
us-west-1
Starting DynamoDB Locally
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
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
cerami-0.2.2.tar.gz
(36.7 kB
view hashes)
Built Distribution
cerami-0.2.2-py3-none-any.whl
(86.3 kB
view hashes)