https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
t

Tim Ortel

02/28/2024, 7:03 PM
SQLDelight/Postgresql: is there any way to set the transaction isolation level for a transaction?
g

griffio

02/29/2024, 10:44 AM
😞 Sadly, unless someone else knows, the Transacter in JDBCDriver api doesn’t yet support setting the isolation level The only escape hatch is to use
driver.execute
in a transaction block such as:
Copy code
example.myQueries.transaction {
   driver.execute(null, "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE", 0)
   example.myQueries.update(123, "mychange")
}
t

Tim Ortel

02/29/2024, 11:51 AM
Thank you that is actually pretty helpful. This way I could write extensions functions for each isolation level.
However I feel like this is something that should be supported by sqldelight.
2 Views