From 53af60b3536221f2503af29c1e90cf9db1295faf Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 18 May 2020 16:08:33 -0400 Subject: Streamline visitors.iterate This method might be used more significantly in the ORM refactor, so further refine it. * all get_children() methods now work entirely based on iterators. Basically only select() was sensitive to this anymore and it now chains the iterators together * remove all kinds of flags like column_collections, schema_visitor that apparently aren't used anymore. * remove the "depthfirst" visitors as these don't seem to be used either. * make sure select() yields its columns first as these will be used to determine the current mapper. Change-Id: I05273a2d5306a57c2d1b0979050748cf3ac964bf --- lib/sqlalchemy/sql/schema.py | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'lib/sqlalchemy/sql/schema.py') diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 08dc487d4..8d28d6309 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -117,10 +117,6 @@ class SchemaItem(SchemaEventTarget, visitors.Visitable): else: spwd(self) - def get_children(self, **kwargs): - """used to allow SchemaVisitor access""" - return [] - def __repr__(self): return util.generic_repr(self, omit_kwarg=["info"]) @@ -820,21 +816,6 @@ class Table(DialectKWArgs, SchemaItem, TableClause): metadata._add_table(self.name, self.schema, self) self.metadata = metadata - def get_children( - self, column_collections=True, schema_visitor=False, **kw - ): - # TODO: consider that we probably don't need column_collections=True - # at all, it does not seem to impact anything - if not schema_visitor: - return TableClause.get_children( - self, column_collections=column_collections, **kw - ) - else: - if column_collections: - return list(self.columns) - else: - return [] - @util.deprecated( "1.4", "The :meth:`_schema.Table.exists` method is deprecated and will be " @@ -1656,16 +1637,6 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause): selectable.foreign_keys.update(fk) return c.key, c - def get_children(self, schema_visitor=False, **kwargs): - if schema_visitor: - return ( - [x for x in (self.default, self.onupdate) if x is not None] - + list(self.foreign_keys) - + list(self.constraints) - ) - else: - return ColumnClause.get_children(self, **kwargs) - class ForeignKey(DialectKWArgs, SchemaItem): """Defines a dependency between two columns. -- cgit v1.2.1