I am having trouble closing a sqlite db in memory. During testing, I create
a connection to a sqlite db, run the test, shutdown and repeat several
What I expected to happen was a new db for each call to connectionForURI()
I've gone as far as this for each test -
TableClassObject._connection =3D connectionForURI("sqlite:/:memory:")
So, Is there a way to get the :memory: object off the heap so it is
reinitialized on the next connection?
I'm new on the list, BTW. Hello all. Great peice of software, glad to be
that's great. I figured this one had been hashed out before.
I agree about passing a reference to the db as a good way. It seems like
more of an expected behavior. Especially in objects designed with unit
tests, where you often times you want to determine the database at runtime.
Having a persistent memory database defies the isolated test principle. Gla=
I found this one early.
On 11/1/05, daishi@... <daishi@...> wrote:
> On Nov 1, 2005, at 2:12 PM, matthew clark wrote:
> > So, Is there a way to get the :memory: object off the heap so it is
> > reinitialized on the next connection?
> as i understand things this behavior
> isn't to do with the heap, but because
> sqlobject caches connection objects
> based on uri.
> i generally don't mind this behavior,
> except for sqlite:/:memory: where
> i frequently do want to create multiple
> distinct instances from the same uri.
> so i've applied the following to my tree:
> diff -rN old-SQLObject/sqlobject/dbconnection.py
> < if self.cachedURIs.has_key(uri):
> > if (self.cachedURIs.has_key(uri) and
> > not (uri.startswith('sqlite') and
> > ':memory:' in uri)):
> as oleg mentioned in a different thread,
> this may be considered a rather brutish
> way of enforcing what i want, but it suits
> my needs well enough. (i don't really use
> the "magic" of connection singleton/
> caching - if i want the same object,
> i'm okay passing the reference around
> myself ...)