SQLAlchemy has no good way to convert insert, update, and delete stored procedure calls. It would probably not have been so difficult to add the ability to add {{update, insert, delete} extensions to mappers instead, but so far no one has bothered. I find it necessary that simple DML instructions go through stored procedures rather stupidly. It really does not offer anything that you could not do with triggers.
If you cannot avoid stupidity, there are several ways you can use SQLAlchemy to go along with this. However, you will lose some ORM features. You can create ORM objects from the results of the stored procedure using the query (Obj) .from_statement (text ("...")), just so that the column labels in the expression match the column names that you specified in SQLAlchemy for matching.
One way to handle DML operations is to turn off autorun and instead of clearing, run the .new, .dirty, and .deleted sessions to see what has changed, return the corresponding statements as calls to stored procedures, and unload objects before committing.
Or you can simply refuse to monitor SQLAlchemy status and directly call stored procedure calls.
source share