summaryrefslogtreecommitdiff
path: root/test/dialect/test_sqlite.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-12 10:49:17 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-12 10:49:17 -0500
commitd3ee4f6155acbc1b2df85fef3f4d2cdae9e1306c (patch)
tree8e7b005d00d974a28232bc42c94a9277cd76f0ee /test/dialect/test_sqlite.py
parentbbe3f0a27c5b4cb6506d2f23d8a2654c80d6b481 (diff)
downloadsqlalchemy-d3ee4f6155acbc1b2df85fef3f4d2cdae9e1306c.tar.gz
- On the same theme, the REFERENCES clause in a CREATE TABLE
that includes a remote schema to a *different* schema than that of the parent table doesn't render at all, as cross-schema references do not appear to be supported.
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r--test/dialect/test_sqlite.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index 9099ec5d7..19ec260d3 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -391,17 +391,47 @@ class SQLTest(TestBase, AssertsCompiledSQL):
schema='master')
t2 = Table('t2', metadata,
Column('id', Integer, primary_key=True),
- Column('t2_id', Integer, ForeignKey('master.t1.id')),
+ Column('t1_id', Integer, ForeignKey('master.t1.id')),
schema='master'
)
+ t3 = Table('t3', metadata,
+ Column('id', Integer, primary_key=True),
+ Column('t1_id', Integer, ForeignKey('master.t1.id')),
+ schema='alternate'
+ )
+ t4 = Table('t4', metadata,
+ Column('id', Integer, primary_key=True),
+ Column('t1_id', Integer, ForeignKey('master.t1.id')),
+ )
+ # schema->schema, generate REFERENCES with no schema name
self.assert_compile(
schema.CreateTable(t2),
"CREATE TABLE master.t2 ("
"id INTEGER NOT NULL, "
- "t2_id INTEGER, "
+ "t1_id INTEGER, "
"PRIMARY KEY (id), "
- "FOREIGN KEY(t2_id) REFERENCES t1 (id)"
+ "FOREIGN KEY(t1_id) REFERENCES t1 (id)"
+ ")"
+ )
+
+ # schema->different schema, don't generate REFERENCES
+ self.assert_compile(
+ schema.CreateTable(t3),
+ "CREATE TABLE alternate.t3 ("
+ "id INTEGER NOT NULL, "
+ "t1_id INTEGER, "
+ "PRIMARY KEY (id)"
+ ")"
+ )
+
+ # same for local schema
+ self.assert_compile(
+ schema.CreateTable(t4),
+ "CREATE TABLE t4 ("
+ "id INTEGER NOT NULL, "
+ "t1_id INTEGER, "
+ "PRIMARY KEY (id)"
")"
)