You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 4, 2022. It is now read-only.
from stdnet.odm import StdModel, CharField, Router
class Bar(StdModel):
foo = CharField(primary_key=True, unique=True)
if __name__ == '__main__':
models = Router('redis://localhost:6379?db=1')
models.register(Bar)
with models.session().begin() as transaction:
transaction.add(models.bar.new(foo="Hello world"))
transaction.add(models.bar.new(foo="Goodbye world"))
with models.session().begin() as transaction:
transaction.add(models.bar.new(foo="Hello world"))
transaction.add(models.bar.new(foo="Goodbye world"))
for f in models.bar.query().all():
print '%r = %s' % (f, f.foo)
Output
Bar: Bar object = Hello world
Bar: Bar object = Goodbye world
Bar: Bar object = Hello world
Bar: Bar object = Goodbye world
FYI: I am running python-stdnet 0.8.2 on Python 2.7.5+ with Redis 2.8.2 on Ubuntu. Additionally have tried with python-stdnet 0.9a3.