From: Mike Bayer Date: Mon, 3 Apr 2006 05:22:42 +0000 (+0000) Subject: added to_selectable() onto ColumnClause to simplify _get_col_by_original X-Git-Tag: rel_0_1_6~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea275e8d383ca0111fd4b1dc535421fe810a3dab;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git added to_selectable() onto ColumnClause to simplify _get_col_by_original --- diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 45a95795fe..34f59fd9cc 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1033,6 +1033,12 @@ class ColumnClause(ColumnElement): _label = property(_get_label) def accept_visitor(self, visitor): visitor.visit_column(self) + def to_selectable(self, selectable): + """given a Selectable, returns this column's equivalent in that Selectable, if any. + + for example, this could translate the column "name" from a Table object + to an Alias of a Select off of that Table object.""" + return selectable._get_col_by_original(self.original, False) def _get_from_objects(self): if self.table is not None: return [self.table]