Create your own session class that inherits from Sessionand override the method delete()using your own logic (for those classes for which it is required logical delete), returning to the default job for other objects. If you use sessionmaker or a similar factory, you can specify your class in the parameter class_.
Hope this answers your question. But, having said / written that there is SOOO MUCH MORE for logical deletion, especially in terms Referential Integrity, you can write a number of articles on this subject.
source
share