Skip to content Skip to sidebar Skip to footer

How To Create Instance Of A Table Entry But Not Added In Ponyorm?

How can I use a create an instance of a table definition without inserting a row to the corresponding Table. For example what I would like is: from pony import orm from pony.orm im

Solution 1:

PonyORM as ORM doesn't provide anything for this case. You still can use regular python dictionaries or classes.

users = {} # id: info

So when you accumulate (or whatever you doing) info you can create objects like this.

@db_sessiondefinsert_users():
    for k, v in users.items():
        User(id=k, **v)

Post a Comment for "How To Create Instance Of A Table Entry But Not Added In Ponyorm?"