On Thu, Sep 9, 2010 at 12:29 AM, CM <cmpyt...@gmail.com> wrote:
> [...]
> I'm not even sure what a "connection" really is; I assumed it was
> nothing more than a rule that says to write to the database with the
> file named in the parentheses. [...]

The following list is not exclusive, but these are the first things
that I can think of.

- SQLite connections have state like uncommitted transactions
- SQLite connections have page caches and metadata caches (tables,
structures and indices)

Opening and closing SQLite connections is very cheap, but keeping
connections open is usually a better approach. You have to have a
"global" setting like the path to the database file anyway; so you can
wrap a "global" connection object in a factory function just as well.

In database applications that use the raw DB-APi i usually start with
something like:

def get_con():
   # return database connection
   ...

HTH

-- Gerhard
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to