[Sqlalchemy-tickets] Issue #3391: "tables" collection passed to before/after create events for meta
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2015-04-27 18:43:46
|
New issue 3391: "tables" collection passed to before/after create events for metadata no longer a list of tables https://bitbucket.org/zzzeek/sqlalchemy/issue/3391/tables-collection-passed-to-before-after Mike Bayer: again due to #3282, the format of the "tables" collection has changed and we aren't converting it back to the previous format nor did we put anything in migration about it. While the documentation doesn't claim a format here, the collection is still key enough that we should probably keep it as it was: ``` #!diff diff --git a/test/engine/test_ddlevents.py b/test/engine/test_ddlevents.py index 1830017..3416b0e 100644 --- a/test/engine/test_ddlevents.py +++ b/test/engine/test_ddlevents.py @@ -19,29 +19,41 @@ class DDLEventTest(fixtures.TestBase): self.state = None self.schema_item = schema_item self.bind = bind + if isinstance(schema_item, MetaData): + self.tables = set(schema_item.tables.values()) + else: + self.tables = None def before_create(self, schema_item, bind, **kw): assert self.state is None assert schema_item is self.schema_item assert bind is self.bind + if self.tables: + eq_(self.tables, set(kw['tables'])) self.state = 'before-create' def after_create(self, schema_item, bind, **kw): assert self.state in ('before-create', 'skipped') assert schema_item is self.schema_item assert bind is self.bind + if self.tables: + eq_(self.tables, set(kw['tables'])) self.state = 'after-create' def before_drop(self, schema_item, bind, **kw): assert self.state is None assert schema_item is self.schema_item assert bind is self.bind + if self.tables: + eq_(self.tables, set(kw['tables'])) self.state = 'before-drop' def after_drop(self, schema_item, bind, **kw): assert self.state in ('before-drop', 'skipped') assert schema_item is self.schema_item assert bind is self.bind + if self.tables: + eq_(self.tables, set(kw['tables'])) self.state = 'after-drop' def setup(self): ``` |