On Wed, Apr 30, 2008 at 9:29 AM, Michael Bayer <[EMAIL PROTECTED]> wrote:
>  after_update() is called after all UPDATE statements have been issued
>  for that particular mapper.  This includes *only* the table that is
>  mapped by that mapper, not any other mappers.
>
>  Is it possible that you are seeing an UPDATE being issued for an item
>  that is related to your parent via a many-to-one ?   Or that you have
>  multiple ME's with after_update() at play and perhaps you're seeing a
>  different one fire off.

It was, but I've managed to reproduce the problem with a fairly
minimal test case:

import pdb
import datetime
import pprint

from pkg_resources import require
require('SQLAlchemy==0.4.3')
from sqlalchemy import *
from sqlalchemy.orm import *

class MyExtension (MapperExtension) :
   def after_update (self, mapper, connection, instance) :
      #pdb.set_trace()
      pprint.pprint(instance)
      return EXT_CONTINUE

class Schedule (object) : pass

dburl = 'postgres://names have been changed to protect the innocent'
engine = create_engine(dburl, strategy='threadlocal')
meta = MetaData(engine)
Session = scoped_session(sessionmaker(bind=engine,
                                      autoflush=False,
                                      transactional=False))
mapper = Session.mapper
meta.reflect()
mapper(Schedule, meta.tables['schedules'], extension=MyExtension())

s = Schedule.query.first()
s.notes = str(datetime.datetime.now())
Session.flush([s])



When this code drops me into pdb, the data in instance.notes looks
like the new value, but querying the db in a separate process gets me
the old value.

-- 
david bonner
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to