I guess a feature suggestion at this point is to implement database object pooling with the above in mind. This is true if there is no dependence between executed statements otherwise (as in master-detail updates) you'll have to ensure proper order of execution If I am doing a transaction, I just create a new database object and throw it away after the transaction. This further leads me to conclude that db.serialize() itself is pointless with transactions. I don't think this is a good idea you'll have to ensure Transaction semantics yourself (specially Isolation) this is a burden the database should take care of (and can better handle) Yes, this could be achieved by some pool implementation (see below)Īlternatively i have to somehow track that there is no pending transaction So you have to use multiples connections to ensure proper isolation between concurrent should not use this database object for anything else other than this transaction If i understand properly, new sqlite3.Database(.) rely on the sqlite3_open_.() However, there is no isolation between operations that occur within the same database connection. SQLite provides isolation between operations in separate database connections. No Isolation Between Operations On The Same Database Connection This is the usual and expected behavior for SQL database systems. This is true regardless of whether the two database connections are in the same thread, in different threads of the same process, or in different processes. Partial changes by the writer that have not been committed are invisible to the reader. If the same database is being read and written using two different database connections (two different sqlite3 objects returned by separate calls to sqlite3_open()) and the two database connections do not have a shared cache, then the reader is only able to see complete committed transactions from the writer. It seems impossible to ensure transaction properties with db.serialize only.Īs documentation say Isolation Between Database Connections
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |