def test(loop): yield from www.orm.create_pool(loop=loop, user='******', password='******', db='blog') #u = User(name='Test4', email='*****@*****.**', passwd='1234567890', image='about:blank') #yield from u.save() ulist = yield from User.findAll() for u in ulist: print(u) num = yield from User.findNumber() print('number is %s' % num)
def test_users(): users = User.find_all() return dict(users=users)
# -*- coding:utf-8 -*- from www.Model import User from www.transwarp import dbHandler db = dbHandler db.create_engine(user='******', password='******', database='awesome') u = User(name="qqw", email='*****@*****.**', password='******',image='about:blank') u.insert() print 'new User id :', u.id u1 = User.find_first("where email = ?",'*****@*****.**') print u1 u2 = User.find_first('where email=?', '*****@*****.**') print 'find user:', u2