From 3f87c7f61d111920dd51be42b58f420d45b011ef Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 3 Aug 2010 15:22:24 -0400 Subject: [PATCH] - Added full description of parent table/column, target table/column in error message raised when ForeignKey can't resolve target. --- CHANGES | 4 ++++ lib/sqlalchemy/schema.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b44edcede6..484f8c6d74 100644 --- a/CHANGES +++ b/CHANGES @@ -95,6 +95,10 @@ CHANGES be used a little more freely for ad-hoc column expressions than before. literal_column() is still the better choice, however. + + - Added full description of parent table/column, + target table/column in error message raised when + ForeignKey can't resolve target. - declarative - if @classproperty is used with a regular class-bound diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 1630bfb518..7bc3f63b76 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -1140,8 +1140,9 @@ class ForeignKey(SchemaItem): if _get_table_key(tname, schema) not in parenttable.metadata: raise exc.NoReferencedTableError( - "Could not find table '%s' with which to generate a " - "foreign key" % tname) + "Foreign key assocated with column '%s' could not find " + "table '%s' with which to generate a " + "foreign key to target column '%s'" % (self.parent, tname, colname)) table = Table(tname, parenttable.metadata, mustexist=True, schema=schema) -- 2.47.2