Skip to content

Simple sql build for asyncpg, map python statement to sql.

License

Notifications You must be signed in to change notification settings

superisaac/sqlmat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlmat

Simple sql build for asyncpg, map python statement to sql.

examples

# select all rows
await sqlmat.table('user').filter(name='tom').select()
# update
await sqlmat.table('user').filter(gendor='male').update(gendor='female')
# get one row
await sqlmat.table('user').filter(city='beijing').get_one()
# set default pool
pool = ...   # get asyncpg pool
sqlmat.set_default_pool(pool)
# transaction using connection
pool = ...
async with pool.acquire() as conn:
    async with conn.transaction():
        await sqlmat.table(
            'user').using(
                conn).filter(grade=3).update(
                    grade=sqlmat.F('grade') + 3)

About

Simple sql build for asyncpg, map python statement to sql.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages