From c4955c05a3ab40d53c83982da612e746c662640d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 29 Mar 2008 00:00:49 +0000 Subject: - merged with_polymorphic branch, which was merged with query_columns branch - removes everything to do with select_table, which remains as a keyword argument synonymous with with_polymorphic=('*', select_table). - all "polymorphic" selectables find their way to Query by way of _set_select_from() now, so that all joins/aliasing/eager loads/etc. is handled consistently. Mapper has methods for producing polymorphic selectables so that Query and eagerloaders alike can get to them. - row aliasing simplified, so that they don't need to nest. they only need the source selectable and adapt to whatever incoming columns they get. - Query is more egalitarian about mappers/columns now. Still has a strong sense of "entity zero", but also introduces new unpublished/experimental _values() method which sets up a columns-only query. - Query.order_by() and Query.group_by() take *args now (also still take a list, will likely deprecate in 0.5). May want to do this for select() as well. - the existing "check for False discriminiator" "fix" was not working completely, added coverage - orphan detection was broken when the target object was a subclass of the mapper with the orphaned relation, fixed that too. --- lib/sqlalchemy/sql/expression.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index f4611de6d..3d95948cb 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1621,6 +1621,15 @@ class FromClause(Selectable): from sqlalchemy.sql.util import ClauseAdapter return ClauseAdapter(alias).traverse(self, clone=True) + def correspond_on_equivalents(self, column, equivalents): + col = self.corresponding_column(column, require_embedded=True) + if col is None and col in equivalents: + for equiv in equivalents[col]: + nc = self.corresponding_column(equiv, require_embedded=True) + if nc: + return nc + return col + def corresponding_column(self, column, require_embedded=False): """Given a ``ColumnElement``, return the exported ``ColumnElement`` object from this ``Selectable`` which corresponds to that -- cgit v1.2.1