summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-20 12:31:27 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-20 12:31:27 +0000
commita31979937223c68f395ee0704593c9150f10e86b (patch)
tree38631a67d1116c1014a894f940db540bbcc9845e /lib/sqlalchemy/sql.py
parent19de5346c2ce305327025d48ae5ed0d9626598ad (diff)
downloadsqlalchemy-a31979937223c68f395ee0704593c9150f10e86b.tar.gz
- tightened down conditions used to locate "relation direction", associating
the "foreignkey" of the relationship with the "primaryjoin". the column match now must be exact, not just "corresponding". this enables self-referential relationships on a polymorphic mapper. - a little bit of improvement to the concept of a "concrete" inheritance mapping, though that concept is not well fleshed out yet (added test case to support concrete mappers on top of a polymorphic base).
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py
index f944b468d..5b960546e 100644
--- a/lib/sqlalchemy/sql.py
+++ b/lib/sqlalchemy/sql.py
@@ -728,9 +728,17 @@ class FromClause(Selectable):
if not hasattr(self, '_oid_column'):
self._oid_column = self._locate_oid_column()
return self._oid_column
- def corresponding_column(self, column, raiseerr=True, keys_ok=False):
+ def corresponding_column(self, column, raiseerr=True, keys_ok=False, require_exact=False):
"""given a ColumnElement, return the ColumnElement object from this
Selectable which corresponds to that original Column via a proxy relationship."""
+ if require_exact:
+ if self.columns.get(column.key) is column:
+ return column
+ else:
+ if not raiseerr:
+ return None
+ else:
+ raise exceptions.InvalidRequestError("Column instance '%s' is not directly present in table '%s'" % (str(column), str(column.table)))
for c in column.orig_set:
try:
return self.original_columns[c]