are there pros or contras, keeping a connection to a (sqlite) database ?
John Nagle
nagle at animats.com
Wed Sep 8 14:39:50 EDT 2010
On 9/8/2010 10:09 AM, Stef Mientki wrote:
> hello,
>
> I wrap my database in some class, and on creation of the instance, a connection to the database is
> created,
> and will stay connected until the program exists, something like this:
>
> self.conn = sqlite3.connect ( self.filename )
>
> Now I wonder if there are pros or contras to keep the connection to the database continuously "open" ?
>
> thanks,
> Stef Mientki
Open is OK. Open is good, because the database system
gets to cache some data. Open with an uncommitted transaction
may leave the file locked, preventing access by other processes.
So make sure you commit before you go idle.
John Nagle
More information about the Python-list
mailing list