'How to verify a transaction status of SQLAlchemy Session

I want to debug my python program by verifying whether a transaction has begun or not, and the duration. Does SQLalchemy have a kind of method?

if session.has_transaction_begun():
    session.show_transaction_time()

I cannot see the MySQL status directly because I have no permission to see information_schema.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source