Skip to main content

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

Project description

Build Status Coverage PyPI Slack Gun.io Patreon

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

It’s an incredibly simple Pythonic object store based on S3.

Useful for prototyping, casual hacking, and (maybe) even low-traffic server-less backends!

Features

  • Schema-less!

  • Server-less!

  • Uses S3 as a datastore.

  • Loads to native Python objects with cPickle

  • Alternately use JSON as a storage format for untrusted data

  • Cheap!

  • Fast(ish)

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.

# Set it up
from nodb import NoDB

nodb = NoDB()
nodb.bucket = "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)

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

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

Advanced Usage

Different Serializers

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

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

Object Metadata

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

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

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

TODO (Maybe?)

  • Tests

  • Different serializers

  • Custom serializers

  • Local file storage

  • Quering ranges (numberic IDs only), etc.

  • Multiple indexes

  • Compression

  • Bucket management

  • Dumps

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

  1. Rich Jones 2017, MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

nodb-0.1.1-py2-none-any.whl (8.0 kB view hashes)

Uploaded Python 2

nodb-0.1.0-py2-none-any.whl (7.9 kB view hashes)

Uploaded Python 2

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