Rudimentary Art of Programming & Development

Promoting Open Source, Always…

SQLAlchemy: does not call __init__

leave a comment »

When performing query(), SQLAlchemy does not execute __init__ of the corresponding ORM objects.

Thus, if you have some logic inside __init__, those won’t get executed.

To have the desired behavior, you need to put such logic inside a function that takes no arguments, then, attach @orm.reconstructor on it.

Reference:

Written by didip

June 14, 2009 at 1:16 pm

Posted in python, sqlalchemy

Tagged with ,

Leave a Reply