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

David Raymond <[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <VI1PR07MB602906FAABD52FF3CA9E0A3D87040@VI1PR07MB6029.eurprd07.prod.outlook.com>
That's just my own personal paranoia wanting to make sure the cursor always gets closed, even on an exception. As I don't think the normal context manager on a cursor closes it when it exits.

In the real world it's probably overkill as
a) The destructors probably take care of that
b) It's the connection you're more worried about and not the cursor
c) SQLite is designed to handle crashes, etc.


-----Original Message-----
From: sqlite-users <[email protected]> On Behalf Of Peng Yu
Sent: Thursday, January 30, 2020 11:02 AM
To: SQLite mailing list <[email protected]>
Subject: Re: [sqlite] Does .commit() 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
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.