From: Mike Bayer Date: Tue, 3 Aug 2010 19:22:24 +0000 (-0400) Subject: - Added full description of parent table/column, X-Git-Tag: rel_0_6_4~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f87c7f61d111920dd51be42b58f420d45b011ef;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Added full description of parent table/column, target table/column in error message raised when ForeignKey can't resolve target. --- 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)