On Monday, June 6, 2011, Michael Bayer <mike...@zzzcomputing.com> wrote: > it just changes to .columns, should fix it as below: > > def __init__(self, table): > event.listen(table, "before_create", self.before_create) > event.listen(table, "after_create", self.after_create) > event.listen(table, "before_drop", self.before_drop) > event.listen(table, "after_drop", self.before_drop) > self._stack = [] > > def before_create(self, target, connection, **kw): > self("before-create", target, connection) > > def after_create(self, target, connection, **kw): > self("after-create", target, connection) > > def before_drop(self, target, connection, **kw): > self("before-drop", target, connection) > > def after_drop(self, target, connection, **kw): > self("after-drop", target, connection) > > def __call__(self, event, table, bind): > if event in ('before-create', 'before-drop'): > regular_cols = [c for c in table.c if not isinstance(c.type, > Geometry)] > gis_cols = set(table.c).difference(regular_cols) > self._stack.append(table.c) > table.columns = expression.ColumnCollection(*regular_cols) > > if event == 'before-drop': > for c in gis_cols: > bind.execute(select([func.DropGeometryColumn('public', > table.name, c.name)], autocommit=True)) > > elif event == 'after-create': > table.columns = self._stack.pop() > > for c in table.c: > if isinstance(c.type, Geometry): > bind.execute(select([func.AddGeometryColumn(table.name, > c.name, c.type.srid, c.type.name, c.type.dimension)], autocommit=True)) > elif event == 'after-drop': > table.columns = self._stack.pop()
Thanks! Will try that tomorrow. -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.