Table.append_ddl_listener: listeners are passed keyword arguments

Issue #2206 resolved
Former user created an issue

In 0.7.x, the event system was changed and unfortunately this change broke the old DDL listener system which only expects three positional arguments:

from sqlalchemy import *

test = Table('test', MetaData(), Column('id', Integer, primary_key=True))

if __name__ == '__main__':
    test.append_ddl_listener('after-create', lambda e, t, b: None)
    engine = create_engine('sqlite://')
    test.create(engine)

Results in the following:

File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/schema.py", line 474, in adapt_listener
  listener(event_name, target, connection, **kw)
TypeError: <lambda>() got an unexpected keyword argument 'checkfirst'

This should not happen if the point was to maintain backwards compatibility with the old event system.

Comments (2)

  1. Log in to comment