descriptionPython library for schema-less, sharded data (ala CouchDB, FriendFeed)
homepage URLhttp://github.com/bickfordb/waffle/tree/master
repository URLhttps://github.com/bickfordb/waffle.git
ownersrinivasanr@gmail.com
last changeWed, 8 Jul 2009 05:06:28 +0000 (7 22:06 -0700)
last refreshSat, 31 Oct 2009 21:18:28 +0000 (31 22:18 +0100)
content tags
add:
README.md

Waffle is a Python library for storing data in a schema-less, document oriented way using a relational database

Similar designs:

Advantages:

Disadvantages:

Requirements So Far

Small Example:

import time

import sqlalchemy
import waffle

_engines = [
    sqlalchemy.create_engine('sqlite:///:memory:'), 
    sqlalchemy.create_engine('sqlite:///:memory:'), 
]

# Define a blog post entity that's searchable by time

def to_time(record):
    yield {'time': int(time.mktime(record.created.timetuple()))}

time_idx = waffle.Index('blog_time', 
    columns=[sqlalchemy.Column('time', sqlalchemy.Integer())], 
    shard=waffle.ShardByPrimaryKey(_engines),
    mapper=to_time)

class BlogPost(waffle.Record):
    def __init__(self, **kwargs):
        kwargs.setdefault('value', {'body': '', 'title': ''})
        super(BlogPost, self).__init__(**kwargs)

blog_posts = waffle.Entity('blog', engines=_engines, indices=[time_idx], record_class=BlogPost)

# Create the table and indices if they don't already exist
blog_posts.create()

# Make a new blog post
blog_post = blog_posts.new()
blog_post.value['title'] = 'My First Blog Post'
blog_post.value['body'] = 'It\'s a sunny day in San Francisco.'

# Save it
blog_posts.save(blog_post)

# Print the blog posts for today:
# (prints => My First Blog Post)
for blog_post in blog_posts.select(time_idx.c.time >= (time.time() - 86400)):
    print blog_post.value['title']
shortlog
2009-07-08 Brandon BickfordMerge branch 'master' of git@github.com:bickfordb/wafflemaster
2009-07-08 Brandon Bickfordadd execute-tests.sh
2009-07-07 Brandon Bickfordadd a test (that is mostly just the example code for...
2009-07-06 cnuRemoved hardcoding of record.id hashing in Entity
2009-07-06 cnuFixed issue #1 : Decode the record body into dict
2009-07-06 cnuAdded zlib compression to the value stored.
2009-07-05 cnuCleaned up __init__.py and moved to a seperate waffle...
2009-07-05 cnuMoved the BinaryEncodedColumn and UUIDColumn, custom...
2009-07-05 cnuMoved Sharding stategy classes to a seperate module
2009-07-05 cnuMoved the codecs classes to a seperate file (out of...
2009-07-05 cnuAdded more globs to .gitignore.
2009-06-20 Brandon Bickfordfix setup.py categories
2009-06-20 Brandon BickfordAdd a setup.py
2009-06-20 Brandon Bickfordadd documentation
2009-06-19 Brandon Bickfordmostly make things work
2009-06-15 Brandon Bickfordfix bullets
...
heads
14 years ago master