Re: [sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically?

2020-01-30 Thread David Raymond
) ensure the .execute()'s and .executemany()'s called before are run atomically? Thanks. What is the purpose of contextlib. If I just use `cur = conn.cursor()`, what problems it will cause? > with contextlib.closing(conn.cursor()) as cur: -- Regards, Peng __

Re: [sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically?

2020-01-30 Thread Peng Yu
Thanks. What is the purpose of contextlib. If I just use `cur = conn.cursor()`, what problems it will cause? > with contextlib.closing(conn.cursor()) as cur: -- Regards, Peng ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http:

Re: [sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically?

2020-01-30 Thread David Raymond
-Original Message- From: sqlite-users On Behalf Of Peng Yu Sent: Thursday, January 30, 2020 5:16 AM To: SQLite mailing list Subject: Re: [sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically? Could you show a python example

Re: [sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically?

2020-01-30 Thread Peng Yu
Could you show a python example on how to make multiple entries either being all inserted (each entry done by an insert statement) or none on any error (e.g. ctrl-c)? I also want want to make sure no two python processes simultaneously editing these entries. I am not sure I fully understand how to

Re: [sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically?

2020-01-29 Thread Keith Medcalf
On Wednesday, 29 January, 2020 22:45, Peng Yu wrote: >In python sqlite3 program, if I call .execute() multiple times then >call .commit(). Does it ensure that all the sqlite3 commands specified >by execute()'s either all take effect or none effect? Mayhaps yes, mayhaps no. .commit() is merely

[sqlite] Does .commit() ensure the .execute()'s and .executemany()'s called before are run atomically?

2020-01-29 Thread Peng Yu
In python sqlite3 program, if I call .execute() multiple times then call .commit(). Does it ensure that all the sqlite3 commands specified by execute()'s either all take effect or none effect? In other words, if any error occurs while running the sqlite3 commands specified in execute(), what happe