On May 7, 2010, at 12:41 PM, Ergo wrote: > Hi, > > I do something like this to invalidate: > --code-- > User.by_id(id, invalidate=True) > --code-- > and on next request > c.user = User.by_id(id) > > and no - regular query DOES NOT return right contents for me. > > c.users = meta.Session.query(User).order_by(User.username).limit(30) > - this will only return right values if i explictly invalidate the > cache - while i never nowhere cached this query with query cache. > whats even more interesting: > q = meta.Session.query(User).filter(User.id == id) - i have to > invalidate THIS to get the query above working fine. > > Whats better, > I invalidate the cache - and see the query executed against the > database in console - > i can see difference if i run invalidation or not. But even if i do > see the query executed if i print the values the values are still > fetched from cache.
expire_all() your session. that is why you are seeing your stale cache data with a query that does not specify cache. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.