/aio-sqlalchemy

🎩🎩A sqlalchemy plugin for monk.

Primary LanguagePythonMIT LicenseMIT

Monk-sqlalchemy

A python async Mysql orm base on aiomysql. Now only support simple select, delete ,insert.

GetStart

define a model

from monk_sqlalchemy import orm

class User(orm.Model):
    user_id = orm.Integer(primary_key=True)
    name = orm.String(legth=255,default=None)

connection

  await conn.connection(loop=loop, **sql_config)

insert

c1 = User(name='su')
await c1.save()

select

get all

User.all()

get by condition

User.find_by(id=1)