From: Ian B. <ia...@co...> - 2004-10-01 16:18:28
|
CLIFFORD ILKAY wrote: > I have eliminated Webware out of the loop for testing purposes. > Regardless of whether I use two different SQLObject instances to change > the data or one instance of SQLObject with psql, I get the same > behaviour. Below, I have two Python shells running which I have called > Instance 1 and Instance 2. You will notice that the second instance does > NOT see changes made by the first even though SQLObject is used on both > cases. Yes, it's really an issue of two processes -- one process doesn't see what the other process is doing. > How would you use sync() or expire() in the example below? I could not > find any documentation on it. You'd put in .sync before using the item. But that will lead to an excess of queries. I think you can do: GrpType._connection.cache.expireAll() This technique isn't well tested. But it will essentially forget all the cached values. Hmm... or maybe you need to do: cache = GrpType._connection.cache for id in cache.allIDs(GrpType): cache.expire(id, GrpType) You can also use sync, like this (which will be slow): > Instance 1 > ---------- > >>> from myClasses import * > >>> from psycopg import * # needed to trap for exceptions > >>> grpTypes = GrpType.select(orderBy=GrpType.q.name) > >>> for theGroupType in grpTypes: theGroupType.sync() > ... print theGroupType.id, theGroupType.name > ... > 1 Test 1 > 2 Test 2 > 3 Test 3 > 4 Test 4 > 5 Test 5 > 6 Test 6 > 7 Test 7 -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |