diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-07 12:52:25 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-05-07 12:52:25 -0400 |
commit | 4bc2402cc0bc585af1d0e7d59000f73cf20cf452 (patch) | |
tree | bc753ce330385f31c870ad5ecc4230e899967599 /lib/sqlalchemy/schema.py | |
parent | 7adcb1c7443265fc99d05714c964c795f0fe1c13 (diff) | |
download | sqlalchemy-4bc2402cc0bc585af1d0e7d59000f73cf20cf452.tar.gz |
- Changed the handling in determination of join
conditions such that foreign key errors are
only considered between the two given tables.
That is, t1.join(t2) will report FK errors
that involve 't1' or 't2', but anything
involving 't3' will be skipped. This affects
join(), as well as ORM relationship and
inherit condition logic. Will keep the more conservative
approach to [ticket:2153] in 0.6.
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 47fc7b08c..e85c82ad7 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -1277,7 +1277,8 @@ class ForeignKey(SchemaItem): raise exc.NoReferencedTableError( "Foreign key associated with column '%s' could not find " "table '%s' with which to generate a " - "foreign key to target column '%s'" % (self.parent, tname, colname)) + "foreign key to target column '%s'" % (self.parent, tname, colname), + tname) table = Table(tname, parenttable.metadata, mustexist=True, schema=schema) @@ -1302,7 +1303,8 @@ class ForeignKey(SchemaItem): raise exc.NoReferencedColumnError( "Could not create ForeignKey '%s' on table '%s': " "table '%s' has no column named '%s'" % ( - self._colspec, parenttable.name, table.name, key)) + self._colspec, parenttable.name, table.name, key), + table.name, key) elif hasattr(self._colspec, '__clause_element__'): _column = self._colspec.__clause_element__() |