summaryrefslogtreecommitdiff
path: root/test/sql/selectable.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-05-02 01:02:23 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-05-02 01:02:23 +0000
commite3460573d037e27592995277a19840be13457828 (patch)
tree90fbd43479edb50e2cdc12f40fa90bc5368ed846 /test/sql/selectable.py
parentc407a608c38a8d483e77fb950b21995b16fa05f7 (diff)
downloadsqlalchemy-e3460573d037e27592995277a19840be13457828.tar.gz
- factored out the logic used by Join to create its join condition
- With declarative, joined table inheritance mappers use a slightly relaxed function to create the "inherit condition" to the parent table, so that other foreign keys to not-yet-declared Table objects don't trigger an error.
Diffstat (limited to 'test/sql/selectable.py')
-rwxr-xr-xtest/sql/selectable.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/sql/selectable.py b/test/sql/selectable.py
index f9cf8295d..20788fedc 100755
--- a/test/sql/selectable.py
+++ b/test/sql/selectable.py
@@ -6,6 +6,7 @@ import testenv; testenv.configure_for_tests()
from sqlalchemy import *
from testlib import *
from sqlalchemy.sql import util as sql_util
+from sqlalchemy import exceptions
metadata = MetaData()
table = Table('table1', metadata,
@@ -222,6 +223,18 @@ class SelectableTest(TestBase, AssertsExecutionResults):
assert u.corresponding_column(s.oid_column) is u.oid_column
assert u.corresponding_column(s2.oid_column) is u.oid_column
+ def test_two_metadata_join_raises(self):
+ m = MetaData()
+ m2 = MetaData()
+
+ t1 = Table('t1', m, Column('id', Integer), Column('id2', Integer))
+ t2 = Table('t2', m, Column('id', Integer, ForeignKey('t1.id')))
+ t3 = Table('t3', m2, Column('id', Integer, ForeignKey('t1.id2')))
+
+ s = select([t2, t3], use_labels=True)
+
+ self.assertRaises(exceptions.NoSuchTableError, s.join, t1)
+
class PrimaryKeyTest(TestBase, AssertsExecutionResults):
def test_join_pk_collapse_implicit(self):
"""test that redundant columns in a join get 'collapsed' into a minimal primary key,