Re: [sqlite] Consistency, rollback and such

2016-09-21 Thread Dominique Devienne
On Wed, Sep 21, 2016 at 12:02 AM, Richard Hipp wrote: > If you do a "BEGIN;" followed by a "SELECT..." then the transaction > starts before the SELECT is run. So it is serializable. > > But if you do just a "BEGIN", then some other process might jump in > line ahead of you and

Re: [sqlite] Consistency, rollback and such

2016-09-20 Thread Kevin O'Gorman
Thanks. That seems clear, and I think I understand it, and the conflicts that I was referring to result in exceptions thrown at commit() time. That makes sense. I don't think I'll be doing any rollbacks -- the logic is hard enough as it stands. I'll just wrap it all in IMMEDIATE transactions.

Re: [sqlite] Consistency, rollback and such

2016-09-20 Thread Richard Hipp
On 9/20/16, Kevin O'Gorman wrote: > Surely, Mr. Hipp is an authority, but I'm slightly puzzled by this answer. > And it doesn't answer the part of the question about what happens if I do > it wrong, and transactions conflict. Based on what I now think is true, if > I

Re: [sqlite] Consistency, rollback and such

2016-09-20 Thread Kevin O'Gorman
t; Sent: Tuesday, September 20, 2016 12:35 PM > To: sqlite-users > Subject: [sqlite] Consistency, rollback and such > > I'm also wondering if setting > conn = sqlite3.connect("mydb", isolation_level=IMMEDIATE) > does what I need. Reading the docs, it would appear thi

Re: [sqlite] Consistency, rollback and such

2016-09-20 Thread Kevin O'Gorman
Surely, Mr. Hipp is an authority, but I'm slightly puzzled by this answer. And it doesn't answer the part of the question about what happens if I do it wrong, and transactions conflict. Based on what I now think is true, if I don't do something, transactions begin with the first modification.

Re: [sqlite] Consistency, rollback and such

2016-09-20 Thread David Raymond
f Of Kevin O'Gorman Sent: Tuesday, September 20, 2016 12:35 PM To: sqlite-users Subject: [sqlite] Consistency, rollback and such I'm also wondering if setting conn = sqlite3.connect("mydb", isolation_level=IMMEDIATE) does what I need. Reading the docs, it would appear this does not start

Re: [sqlite] Consistency, rollback and such

2016-09-20 Thread Richard Hipp
On 9/20/16, Kevin O'Gorman wrote: > c.execuite("BEGIN TRANSACTION IMMEDIATE") > > and is IMMEDIATE the right thing, or do I need EXCLUSIVE. IMMEDIATE is the right thing. That lets other readers continue and new readers to start, but blocks all other writers.

[sqlite] Consistency, rollback and such

2016-09-20 Thread Kevin O'Gorman
I think I understand the basics of SQL and ACID properties, but I'm new to SQLite and not really experienced in any of these. So I'm having some trouble figuring out the detailed consequences of IMMEDIATE, EXCLUSIVE and DEFERRED and the autocommit mode of python's sqlite3. I expect my