librelist archives

« back to archive

SQLite database connections

SQLite database connections

From:
Wouter Van Hemel
Date:
2012-03-16 @ 03:04

Hello,

The SQLite example on the Flask website opens and closes the database
connection for every request. Doesn't this cause a lot of overhead? What
about internal SQLite query caching?

I assume SQLite does adequate locking on writes, so why can't we open the
database globally and keep it open to handle each request?

Thanks for any explanations,

  Wouter

Re: [flask] SQLite database connections

From:
Mickaël Desfrênes
Date:
2012-03-16 @ 12:05
This is relevant to my interests :-)

Maybe some reference to back up the discussion:
http://www.sqlite.org/lockingv3.html

2012/3/16 Wouter Van Hemel <wouter-flask@publica.duodecim.org>

>
>
> Hello,
>
> The SQLite example on the Flask website opens and closes the database
> connection for every request. Doesn't this cause a lot of overhead? What
> about internal SQLite query caching?
>
> I assume SQLite does adequate locking on writes, so why can't we open the
> database globally and keep it open to handle each request?
>
> Thanks for any explanations,
>
>  Wouter
>
>
>