Hey,
I'd like to share my python redis-backed ORM. It follows similar API as other python ORMs, like flask or django.
https://pypi.python.org/pypi/indexedredisor
https://github.com/kata198/indexedredisIt's special in that it's optimized and makes simple storing objects in a relational way; searchable on selected indexed fields (similar to SQL).
I've tested equivalent models with MySQL and Redis, at a performance increase between 600-1200%!
It also supports atomic replacement of entire datasets. This can make it simple to increase the performance of your application: Have a cron job read your SQL stables and do an atomic reset of the Redis storage every five minutes. Or use it instead of SQL for all your data.
A model is defined like this:
class Song(IndexedRedisModel):
FIELDS = [ \
'artist',
'title',
'album',
'track_number',
'duration',
'description',
'copyright',
]
INDEXED_FIELDS = [ \
'artist',
'title',
'track_number',
]
KEY_NAME = 'Songs'
Objects can be saved like this:
songObj = Song(artist='The Unhappy Folk',
title='Sadly she waits',
album='Misery loses comfort',
track_number=1,
duration='15:44',
description='A sad song',
copyright='Copyright 2014 (c) Cheese Industries')
newSongs.append(songObj)
And searched like this:
someSongs = Song.objects.filter(artist='The Unhappy Folk').all()
Underlying data is stored using hashes and sets.
Check out
https://raw.githubusercontent.com/kata198/indexedredis/master/test.py for a full-working example, or the pages listed above for more methods, usage, etc.
Thanks and enjoy! Keep using Redis!