Hi I'm building a simple system by python with SQLite, I set a db file on NFS to allow writing by only one user but with multiple readers from different machines, all I need is to know how to implement isolation by locking the database file and preventing any reads by other database connections while each write transaction is underway, that's a sample of my code:
conn = sqlite3.connect("C:\الموارد البشرية & الرعاية الطبية\HR2.db")
conn.rollback()
c = conn.cursor()
c.execute("INSERT INTO connected VALUES (?,?,?,?)", (record[1], dateYY, first_date, final_date))
conn.commit()
conn.close()
CodePudding user response:
According to sqlite
documentation
the reader is only able to see complete committed transactions from the writer. Partial changes by the writer that have not been committed are invisible to the reader.