Skip to content

Instantly share code, notes, and snippets.

@j2labs
Last active December 30, 2015 19:38
Show Gist options
  • Save j2labs/7875008 to your computer and use it in GitHub Desktop.
Save j2labs/7875008 to your computer and use it in GitHub Desktop.
Thinking out loud on what Tobin might be like.
from tobin.querysets import RedisQuerySet
from schematics.models import Model
from schematics.types import StringType, IntType
class SomeModel(Model):
s = StringType()
i = IntType()
rds = RedisQuerySet("username", "password")
sm = SomeModel()
sm.s = 'foo'
sm.i = 5
sm = rds.create(SomeModel, sm)
# OR
sm_data = {'s': 'foo', 'i': 5}
sm_data = rds.create(SomeModel, sm_data)
# OR
sm_datas = [{'s': 'foo', 'i': 5}, {'s': 'bar', 'i': 6}, {'s': 'baz', 'i': 7}]
sm_datas = rds.create(SomeModel, sm_datas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment