[Sqlalchemy-tickets] Issue #4179: table.tometadata(...) doesn't copy event handlers (zzzeek/sqlalch
Brought to you by:
zzzeek
From: Chris W. <iss...@bi...> - 2018-02-02 07:14:32
|
New issue 4179: table.tometadata(...) doesn't copy event handlers https://bitbucket.org/zzzeek/sqlalchemy/issues/4179/tabletometadata-doesnt-copy-event-handlers Chris Withers: I added some custom DDL to a table definition as follows: ``` #!python event.listen( Observation.__table__, 'after_create', DDL( 'alter table observation add constraint observation_best ...' ) ) ``` ...but it wasn't firing, not even an exception when I deliberately misspelled the table name ;-) Tracked it down to this class I use to allow one schema to be managed by multiple python packages: https://github.com/Mortar/mortar_rdb/blob/master/mortar_rdb/controlled.py#L59 This line in particular: https://github.com/Mortar/mortar_rdb/blob/master/mortar_rdb/controlled.py#L81 It appears that call isn't carrying the event handlers across to the table created in the new metadata object. For my use case, it needs to, but I appreciate my use case may well be a bit of an edge case. |