I would like to define my event "after_create" for class Engine which I 
would invoke with 

eng = create_engine('sqlite:///:memory:')
eng.dispatch.after_create(eng)

I tried this to do this by

class MoreEngineEvents(event.Events):

    _target_class_doc = "SomeEngine"
    _dispatch_target = Engine

    def after_create(self, eng):
        pass

But it seems to override existing events for Engine. For example 
"before_execute".
If I add method _set_dispatch to MoreEngineEvents as

    @staticmethod
    def _set_dispatch(cls, dispatch_cls):
          new_dispatch = dispatch_cls(None)
        dispatch_cls._events = cls
        if cls.dispatch is None:
            cls.dispatch = new_dispatch
        else:
            cls.dispatch = new_dispatch._join(cls.dispatch)
        return cls.dispatch

it does not seem to help.

What can I do?

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to