All Projects → Miserlou → Nodb

Miserlou / Nodb

NoDB isn't a database.. but it sort of looks like one.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nodb

Aws Toolkit Vscode
AWS Toolkit for Visual Studio Code, an extension for working with AWS services including AWS Lambda.
Stars: ✭ 823 (+133.14%)
Mutual labels:  aws, serverless, lambda, s3
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+536.54%)
Mutual labels:  aws, serverless, lambda, s3
Historical
A serverless, event-driven AWS configuration collection service with configuration versioning.
Stars: ✭ 85 (-75.92%)
Mutual labels:  aws, serverless, lambda, s3
Aws Mobile React Sample
A React Starter App that displays how web developers can integrate their front end with AWS on the backend. The App interacts with AWS Cognito, API Gateway, Lambda and DynamoDB on the backend.
Stars: ✭ 650 (+84.14%)
Mutual labels:  aws, serverless, lambda, s3
Workshop Donkeytracker
Workshop to build a serverless tracking application for your mobile device with an AWS backend
Stars: ✭ 27 (-92.35%)
Mutual labels:  aws, serverless, lambda, s3
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+2703.12%)
Mutual labels:  aws, serverless, lambda, s3
Json Serverless
Transform a JSON file into a serverless REST API in AWS cloud
Stars: ✭ 108 (-69.41%)
Mutual labels:  aws, serverless, lambda, json
Streamalert
StreamAlert is a serverless, realtime data analysis framework which empowers you to ingest, analyze, and alert on data from any environment, using datasources and alerting logic you define.
Stars: ✭ 2,634 (+646.18%)
Mutual labels:  aws, serverless, lambda
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+643.63%)
Mutual labels:  aws, serverless, lambda
Cloud Custodian
Rules engine for cloud security, cost optimization, and governance, DSL in yaml for policies to query, filter, and take actions on resources
Stars: ✭ 3,926 (+1012.18%)
Mutual labels:  aws, serverless, lambda
Grant
OAuth Proxy
Stars: ✭ 3,509 (+894.05%)
Mutual labels:  aws, serverless, lambda
Algnhsa
AWS Lambda Go net/http server adapter
Stars: ✭ 226 (-35.98%)
Mutual labels:  aws, serverless, lambda
Aws Serverless Workshops
Code and walkthrough labs to set up serverless applications for Wild Rydes workshops
Stars: ✭ 3,512 (+894.9%)
Mutual labels:  aws, serverless, lambda
Serverless Analytics
Track website visitors with Serverless Analytics using Kinesis, Lambda, and TypeScript.
Stars: ✭ 219 (-37.96%)
Mutual labels:  aws, serverless, lambda
Serverless Slack App
A Serverless.js Slack App Boilerplate with OAuth and Bot actions
Stars: ✭ 217 (-38.53%)
Mutual labels:  aws, serverless, lambda
Serverless Iam Roles Per Function
Serverless Plugin for easily defining IAM roles per function via the use of iamRoleStatements at the function level.
Stars: ✭ 311 (-11.9%)
Mutual labels:  aws, serverless, lambda
Dialetus Service
API to Informal dictionary for the idiomatic expressions that each Brazilian region It has
Stars: ✭ 202 (-42.78%)
Mutual labels:  aws, serverless, json
Komiser
☁️ Cloud Environment Inspector 👮🔒 💰
Stars: ✭ 2,684 (+660.34%)
Mutual labels:  aws, serverless, lambda
Aws Serverless Samfarm
This repo is full CI/CD Serverless example which was used in the What's New with AWS Lambda presentation at Re:Invent 2016.
Stars: ✭ 271 (-23.23%)
Mutual labels:  aws, serverless, lambda
Aws Etl Orchestrator
A serverless architecture for orchestrating ETL jobs in arbitrarily-complex workflows using AWS Step Functions and AWS Lambda.
Stars: ✭ 245 (-30.59%)
Mutual labels:  aws, serverless, lambda

NoDB

Build Status Coverage PyPI Slack Gun.io Patreon

NoDB isn't a database.. but it sort of looks like one!

NoDB an incredibly simple, Pythonic object store based on Amazon's S3 static file storage.

It's useful for prototyping, casual hacking, and (maybe) even low-traffic server-less backends for Zappa apps!

Features

  • Schema-less!
  • Server-less!
  • Uses S3 as a datastore.
  • Loads to native Python objects with cPickle
  • Can use JSON as a serialization format for untrusted data
  • Local filestore based caching
  • Cheap(ish)!
  • Fast(ish)! (Especially from Lambda)

Performance

Initial load test with Goad of 10,000 requests (500 concurrent) with a write and subsequent read of the same index showed an average time of 400ms. This should be more than acceptable for many applications, even those which don't have sparse data, although that is preferred.

Installation

NoDB can be installed easily via pip, like so:

$ pip install nodb

Warning!

NoDB is insecure by default! Do not use it for untrusted data before setting serializer to "json"!

Usage

NoDB is super easy to use!

You simply make a NoDB object, point it to your bucket and tell it what field you want to index on.

from nodb import NoDB

nodb = NoDB("my-s3-bucket")
nodb.index = "name"

After that, you can save and load literally anything you want, whenever you want!

# Save an object!
user = {"name": "Jeff", "age": 19}
nodb.save(user) # True

# Load our object!
user = nodb.load("Jeff")
print(user['age']) # 19

# Delete our object
nodb.delete("Jeff") # True

By default, you can save and load any Python object.

Here's the same example, but with a class. Note the import and configuration is the same!

class User(object):
    name = None
    age = None
    
    def print_name(self):
        print("Hi, I'm " + self.name + "!")
    
    def __repr__(self):
        """ show a human readable representation of this class """
        return "<%s: %s (%s)>" % (self.__class__.__name__, self.name, self.age)

new_user = User()
new_user.name = "Jeff"
new_user.age = 19
nodb.save(new_user) 
# True

jeff = nodb.load("Jeff")
jeff.print_name() 
# Hi, I'm Jeff!

You can return a list of all objects using the .all() method.

Here's an example following from the code above, adding some extra users to the database and then listing all.

newer_user = User()
newer_user.name = "Ben"
newer_user.age = 38
nodb.save(newer_user)
# True

newest_user = User()
newest_user.name = "Thea"
newest_user.age = 33
nodb.save(newest_user)
# True

nodb.all()
# [<User: Jeff (19)>, <User: Ben (38)>, <User: Thea (33)>]

Advanced Usage

Different Serializers

To use a safer, non-Pickle serializer, just set JSON as your serializer:

nodb = NoDB()
nodb.serializer = "json"

Note that for this to work, your object must be JSON-serializable.

Object Metadata

You can get metainfo (datetime and UUID) for a given object by passing metainfo=True to load, like so:

# Load our object and metainfo!
user, datetime, uuid = nodb.load("Jeff", metainfo=True)

You can also pass in a default argument for non-existent values.

user = nodb.load("Jeff", default={}) # {}

Human Readable Indexes

By default, the indexes are hashed. If you want to be able to debug through the AWS console, set human_readable_indexes to True:

nodb.human_readable_indexes = True

Caching

You can enable local file caching, which will store previously retrieved values in the local rather than remote filestore.

nodb.cache = True

AWS settings override

You can override your AWS Profile information or boto3 session by passing either as a initial keyword argument.

nodb = NoDB(profile_name='my_aws_development_profile')
# or supply the session
session = boto3.Session(
    aws_access_key_id=ACCESS_KEY,
    aws_secret_access_key=SECRET_KEY,
    aws_session_token=SESSION_TOKEN,
)
nodb = NoDB(session=session)

TODO (Maybe?)

  • Tests with Placebo
  • Local file storage
  • Quering ranges (numberic IDs only), etc.
  • Different serializers
  • Custom serializers
  • Multiple indexes
  • Compression
  • Bucket management
  • Pseudo-locking
  • Performance/load testing

Related Projects

  • Zappa - Python's server-less framework!
  • K.E.V. - a Python ORM for key-value stores based on Redis, S3, and a S3/Redis hybrid backend.
  • s3sqlite - An S3-backed database engine for Django

Contributing

This project is still young, so there is still plenty to be done. Contributions are more than welcome!

Please file tickets for discussion before submitting patches. Pull requests should target master and should leave NoDB in a "shippable" state if merged.

If you are adding a non-trivial amount of new code, please include a functioning test in your PR. For AWS calls, we use the placebo library, which you can learn to use in their README. The test suite will be run by Travis CI once you open a pull request.

Please include the GitHub issue or pull request URL that has discussion related to your changes as a comment in the code (example). This greatly helps for project maintainability, as it allows us to trace back use cases and explain decision making.

License

(C) Rich Jones 2017, MIT License.


Made by Gun.io

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].