summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-05-19 19:33:58 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-05-19 19:33:58 -0400
commitfbd75af4a7e80a33dcba87592768d6622a54bfba (patch)
tree79c2e02381491d70a25d8c3a2793082672f63a12 /lib/sqlalchemy/sql/util.py
parent6c09e980139a694a0b18d8ef519605f46963405a (diff)
downloadsqlalchemy-fbd75af4a7e80a33dcba87592768d6622a54bfba.tar.gz
ignore columns that don't resolve here either.
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r--lib/sqlalchemy/sql/util.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index cb8359048..c486f5cc1 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -575,7 +575,7 @@ def reduce_columns(columns, *clauses, **kw):
to further identify columns that are "equivalent".
\**kw may specify 'ignore_nonexistent_tables' to ignore foreign keys
- whose tables are not yet configured.
+ whose tables are not yet configured, or columns that aren't yet present.
This function is primarily used to determine the most minimal "primary key"
from a selectable, by reducing the set of primary key columns present
@@ -594,7 +594,16 @@ def reduce_columns(columns, *clauses, **kw):
continue
try:
fk_col = fk.column
+ except exc.NoReferencedColumnError:
+ # TODO: add specific coverage here
+ # to test/sql/test_selectable ReduceTest
+ if ignore_nonexistent_tables:
+ continue
+ else:
+ raise
except exc.NoReferencedTableError:
+ # TODO: add specific coverage here
+ # to test/sql/test_selectable ReduceTest
if ignore_nonexistent_tables:
continue
else: