Limitations (hopefully resolved in a couple of weeks):
currently just aiomysql supported
More thorough testing is on the way.
Any feedback would be greatly appreciated!
pip install aiopeewee
from aiopeewee import AioModel from peewee import CharField, TextField, DateTimeField from peewee import ForeignKeyField, PrimaryKeyField class User(AioModel): username = CharField() class Meta: database = db class Blog(AioModel): user = ForeignKeyField(User) title = CharField(max_length=25) content = TextField(default='') pub_date = DateTimeField(null=True) pk = PrimaryKeyField() class Meta: database = db # create connection pool await db.connect(loop) # count await User.select().count() # insert user = await User.insert(username='kszucs') # modify user.username = 'krisztian' await user.save() # async iteration on blog set [b.title async for b in user.blog_set.order_by(Blog.title)] # close connection pool await db.close() # see more in the tests
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.