I've created this question at stackoverflow 
http://stackoverflow.com/questions/6476652/sqlalchemy-0-6-5-and-0-6-8-sessionextension-after-flush-doesnt-gets-called
 
, but I thought maybe I should also ask here.

I don't get it, but this code doesn't call 
after_flush/before_flush/after_flush_postexec

# -*- coding: utf-8 -*-

from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.orm.interfaces import SessionExtension

class AfterFlushExtension(SessionExtension):
    def before_commit(self, session):
        print "> before_commit"

    def after_commit(self, session):
        print "> after_commit"

    def before_flush(self, session, flush_context, instances):
        print '> before_flush'

    def after_flush(self, session, flush_context):
        print '> after_flush'

    def after_flush_postexec(self, session, flush_context):
        print '> after_flush_postexec'

session = scoped_session(sessionmaker(extension=AfterFlushExtension()))
session.flush()
session.commit()

And a result:

$ python ~/Dropbox/playground/python/sqlalchemy_hook_test/main.py 
> before_commit
> after_commit


Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/40uHGUoHJ1sJ.
To post to this group, send email to sqlalchemy@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.

Reply via email to