From fbd75af4a7e80a33dcba87592768d6622a54bfba Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 19 May 2012 19:33:58 -0400 Subject: ignore columns that don't resolve here either. --- lib/sqlalchemy/sql/util.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/util.py') 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: -- cgit v1.2.1