summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/sqlite
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 /lib/sqlalchemy/dialects/sqlite
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 'lib/sqlalchemy/dialects/sqlite')
-rw-r--r--lib/sqlalchemy/dialects/sqlite/base.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py
index 8ff93580b..994904b6a 100644
--- a/lib/sqlalchemy/dialects/sqlite/base.py
+++ b/lib/sqlalchemy/dialects/sqlite/base.py
@@ -270,7 +270,17 @@ class SQLiteDDLCompiler(compiler.DDLCompiler):
return super(SQLiteDDLCompiler, self).\
visit_primary_key_constraint(constraint)
-
+
+ def visit_foreign_key_constraint(self, constraint):
+
+ local_table = constraint._elements.values()[0].parent.table
+ remote_table = list(constraint._elements.values())[0].column.table
+
+ if local_table.schema != remote_table.schema:
+ return None
+ else:
+ return super(SQLiteDDLCompiler, self).visit_foreign_key_constraint(constraint)
+
def define_constraint_remote_table(self, constraint, table, preparer):
"""Format the remote table clause of a CREATE CONSTRAINT clause."""