Re: Model-level DB cache

2006-10-14 Thread Jeremy Dunck
On 9/28/06, Michael Radziej <[EMAIL PROTECTED]> wrote: > Django probably does start a transaction somewhere, I don't know. > Try to trace your session and you'll see. The way I read the spec for DB-API's connection.commit, all cursors are implicitly under transactions. ".commit Note

Re: Model-level DB cache

2006-10-13 Thread nara
wasn't a DB cache issue in my case, just a bug in my model code. The first run of unittest silently failed, and subsequent ones showed the above stack trace. Running stuff in the python interpreter helped find the problem. I do a connection._rollback() at the start of my unittest now, as insuranc

Re: Model-level DB cache

2006-10-11 Thread nara
I have a similar problem, though I am using PostgreSQL 8.1.3). I run a unittest that creates a bunch of records against the database, all of it using django and the model API. This runs fine the first time, but shows the following stack trace on subsequent runs. It seems to hit the problem at t

Re: Model-level DB cache

2006-09-28 Thread Michael Radziej
Greg Plesur schrieb: > So that's a work-around that I can use, but...is it okay behavior? That > seems pretty broken. Is it possible that Django's DB connection has > auto-commit off, but explicitly calls COMMIT internally on save() > operations when there's no Django-level transaction in pla

Re: Model-level DB cache

2006-09-28 Thread Greg Plesur
That does fix it - thanks Michael. I just want to summarize what I'm seeing, though, in case it helps others: - In no place, either in my MySQL shell or my Python Django session, am I explicitly starting a transaction. Further, my MySQL shell has auto_commit on. - If I make a change in t

Re: Model-level DB cache

2006-09-28 Thread Michael Radziej
Hawkeye schrieb: > I had the same reaction at first... "this has to be a transaction > issue", but I decided to give it a try. > > I'm working from trunk, and here's what I did to recreate the problem: > > == > {{ In manage.py shell }} a = Foo.objects.all() a > [< Foo: Foo 5>,

Re: Model-level DB cache

2006-09-27 Thread Hawkeye
I had the same reaction at first... "this has to be a transaction issue", but I decided to give it a try. I'm working from trunk, and here's what I did to recreate the problem: == {{ In manage.py shell }} >>> a = Foo.objects.all() >>> a [< Foo: Foo 5>, < Foo: Foo 6>, < Foo: Foo 7>, < Foo

Re: Model-level DB cache

2006-09-27 Thread Greg Plesur
Thanks to everyone for the replies here. Just to be clear: I don't think that this is a transactions issue. The Django-side part of this problem doesn't have transactions enabled, and the MySQL-side is just a direct transactionless operation on the DB that can be seen immediately by other cl

Re: Model-level DB cache

2006-09-27 Thread Michael Radziej
Greg Plesur schrieb: > Hi all, > > I'm a new subscriber to this list, and am having an issue that I'm > hoping you can help me with (I also posted this as a trouble-ticket, > because I'm not seeing any references to this issue anywhere and it > seems buggy): > > It looks like my models are ca

Re: Model-level DB cache

2006-09-27 Thread Ivan Sagalaev
Greg Plesur wrote: > But I would _not_ expect to see this: >>>> x=SomeModel.objects.all() # This gets a QuerySet into x >>>> value = x[0] # Some operation to actually fill x's cache >>>> print len(x) # Verify that there are some entries in the table >2 > >>>> y=SomeMode

Re: Model-level DB cache

2006-09-26 Thread Greg Plesur
Don, Don Arbow wrote: > Did you read this documentation, especially the last line of this paragraph? > > http://www.djangoproject.com/documentation/db_api/#id3 > > In a newly created QuerySet, the cache is empty. The first time a > QuerySet is evaluated -- and, hence, a database query happens

Re: Model-level DB cache

2006-09-26 Thread Don Arbow
On Sep 26, 2006, at 6:06 PM, Greg Plesur wrote:Hi all,I'm a new subscriber to this list, and am having an issue that I'm hoping you can help me with (I also posted this as a trouble-ticket, because I'm not seeing any references to this issue anywhere and it seems buggy):It looks like my models are

Model-level DB cache

2006-09-26 Thread Greg Plesur
Hi all, I'm a new subscriber to this list, and am having an issue that I'm hoping you can help me with (I also posted this as a trouble-ticket, because I'm not seeing any references to this issue anywhere and it seems buggy): It looks like my models are caching their DB query in a way that I