title: SQLAlchemy : can't make event.listens.for() work
body: <p>I am new to SQLAlchemy and jumped into it for its ease of use and event mechanisms. I am looking to execute a method after some data is inserted but I keep running into several errors of the type "Attribute[...]" related to the object I am referring to</p>
  
  <pre><code>from sqlalchemy import create_engine
  from sqlalchemy.orm import sessionmaker
  from sqlalchemy.ext.declarative import declarative_base
  from sqlalchemy import Column, ForeignKey
  from sqlalchemy import Integer, UnicodeText
  from sqlalchemy import event
  
  #variables feching is hidden
  db = create_engine("mysql://"+dbLogin+":"+dbPassword+"@"+dbAddress+"/"+dbDatabase)
  metadata = MetaData(db)
  #the log table is not explicitly defined but rather uses the autoload function
  logtable = Table('logs', metadata, autoload=True)
  
  #and here I am trying to start "processLogChanged" after_insert on the "logs" table
  @event.listens_for(logtable, "after_insert")
  def processLogChanged():
      print "---- the log table has changed"
  </code></pre>
  
  <p>I am obviously doing something wrong but I have been scouring through a lot of questions/answers and can't find the right here, it would be great if you could give me a hand</p>
  
  <p>Here is the stack for instance in that case</p>
  
  <pre><code>    Traceback (most recent call last):
       File "optra.py", line 144, in &lt;module&gt;@event.listens_for(logtable, "after_insert")
      File "/home/jpp/anaconda2/lib/python2.7/site-packages/sqlalchemy/event/api.py", line 124, in decorate
      listen(target, identifier, fn, *args, **kw)
    File "/home/jpp/anaconda2/lib/python2.7/site-packages/sqlalchemy/event/api.py", line 89, in listen
      _event_key(target, identifier, fn).listen(*args, **kw)
    File "/home/jpp/anaconda2/lib/python2.7/site-packages/sqlalchemy/event/registry.py", line 194, in listen
      dispatch_collection = getattr(target.dispatch, identifier)
    File "/home/jpp/anaconda2/lib/python2.7/site-packages/sqlalchemy/event/base.py", line 95, in __getattr__
      raise AttributeError(name)
  AttributeError: after_insert
  </code></pre>
  
  <p>Thank you</p>