bill
bill

Reputation: 728

Commit data in sqlite3 python

Hi I have this silly question, but I want to be sure. I have created a database based on sqlite3. I trigger the commit() after 1000k operations so I will not have too much disk I/O. When I seek data on the database, will the select query search only in the database file or will it check the uncommited data too ?

Thanks.

Upvotes: 0

Views: 182

Answers (2)

Larry Lustig
Larry Lustig

Reputation: 50970

If you are using the same SQLite connection for reading as you are for writing the database, then the effects of the writing will be visible to the reader, as expected.

If you are using different connections -- even within a single thread -- for reading and writing, the reader will not see uncommitted writes to the database unless you go to rather significant lengths to allow it to do so.

Upvotes: 0

CL.
CL.

Reputation: 180060

Transactions allow isolation and atomicty regarding other users of the database. Any changes you make are visible in your own connection immediately.

Upvotes: 1

Related Questions