PynamoDB
PynamoDB copied to clipboard
[Feature] add __post_init__ method to allow any customization
WHY
Most of modern ORM or data class library support user custom "Post Initialization Hook" that allow user to run any code after the instance is initialized. By doing this, user can implement their own easily:
- Write Procedure
- Validation
- Or any custom requirements
For example:
- The standard library dataclass support post_init
- The attrs support attrs_post_init
- The sqlalchemy support reconstructor
You should consider doing this too
HOW
I would recommend to just define an dummy function __post_init__ in your Model class and call this function at the end of your __init__ function HERE:
class Model:
def __init__(self, ...):
... # your code
self.__post_init__()
def __post_init__(self):
pass