0

I'm using SQLAlchemy with mysqlclient (1.4.6) for a production application. Thus, I'd like to know what transaction isolation level it's using.

The docs only describes how to set the isolation level (engine-wide), not how to retrieve the default isolation level?

Shuzheng
  • 11,288
  • 20
  • 88
  • 186
  • See https://stackoverflow.com/questions/41825832/mysql-how-to-find-out-isolation-level-for-the-transactions. According to that there's actually no way to get the current effective isolation level in MySQL, but depending on your definition of "default" it may be doable. – Ilja Everilä Apr 15 '20 at 06:36
  • @IljaEverilä - thank you. So, SQLAlchemy provides no attribute for getting the isolation level? After all, SQLAlchemy makes the connection to MySQL, so if it doesn't set any isolation level, then MySQL default isolation level (`REPEATABLE READ`) would be used? – Shuzheng Apr 15 '20 at 06:55
  • After a cursory search it seems that a) SQLA does not set it explicitly by default b) if you do not set it explicitly, there may be no way to get the current level reliably. I did not check if mysqlclient has a role in setting a default level. – Ilja Everilä Apr 15 '20 at 07:03
  • 1
    I would expect you to know the default isolation level of your prod mysql server. If isolation level is so critical to you, you should set it every time you connect to mysql. – Shadow Apr 15 '20 at 07:11
  • Thank you, I guess MySQL will use its default `REPEATABLE READ` isolation level then. – Shuzheng Apr 15 '20 at 07:12

0 Answers0