In my web app some postgres sql queries take along time for execution. I want set statement timeout for only part of them.
One part of queries must canceled by timeo
You should look at the extensions provided with SQLAlchemy <= 0.6:
http://www.sqlalchemy.org/docs/06/orm/interfaces.html
There are hooks where you could stick in your code for individual operations.
SQLAlchemy 0.7+ now has an event system...there might be something similar. See
http://www.sqlalchemy.org/docs/core/events.html