Skip to content

renskiy/ormageddon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ORMageddon

ORMageddon is asynchronous ORM framework based on peewee. For now it supports only PostgreSQL using aiopg.

Status

Currently ORMageddon is only a proof of concept demonstration and is not ready for production yet. Please contact me if you are interested in further development of the project.

Some examples

You can test ORMageddon using following little example:

import ormageddon

db = ormageddon.PostgresqlDatabase(database='ormageddon', user='postgres', host='127.0.0.1')

class User(ormageddon.Model):

    class Meta:
        database = db

    id = ormageddon.PrimaryKeyField()

async def get_user(user_id):
    return await User.get(User.id == user_id)

async def print_users(start=None, stop=None):
    async for user in User.select()[start:stop]:
        print(user)

async def create_user():
    user = User()
    await user.save()

Transactions

async def manual_transaction():
    await db.begin()
    try:
        # do whatever you need
    except:
        await db.rollback()
        raise
    else:
        await db.commit()

async def transaction_context():
    async with db.transaction() as transaction:
        # do whatever you need

About

Asynchronous ORM framework for Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages