Data Table Views and Transactions

Did digging into the source, in_transaction wrapper eventually resolved to a clojure function called open-app-transaction!

Inside it, it uses JDBC (the java/JVM alternative to ODBC) to call the basic PostgreSQL isolation levels.

This means that:

  1. Normal interactions with an anvil row are treated at Read Committed Isolation Level
  2. @anvil.tables.in_transaction(relaxed=True) interactions are set to Repeatable Read Isolation Level
  3. The full @anvil.tables.in_transaction is set to the PostgreSQL version of Serializable Isolation Level

The explanation of transaction isolation itself along with who what and how locks are handled (by row / rows or by table, how it handles deadlocks etc) can be found at the top of the docs found on postgresql.org

3 Likes