summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/databases/sqlite.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/databases/sqlite.py')
-rw-r--r--lib/sqlalchemy/databases/sqlite.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py
index bb46578a3..2e366e432 100644
--- a/lib/sqlalchemy/databases/sqlite.py
+++ b/lib/sqlalchemy/databases/sqlite.py
@@ -182,7 +182,9 @@ class SQLiteSQLEngine(ansisql.ANSISQLEngine):
break
(tablename, localcol, remotecol) = (row[2], row[3], row[4])
#print "row! " + repr(row)
- remotetable = Table(tablename, self, autoload = True)
+ # look up the table based on the given table's engine, not 'self',
+ # since it could be a ProxyEngine
+ remotetable = Table(tablename, table.engine, autoload = True)
table.c[localcol].append_item(schema.ForeignKey(remotetable.c[remotecol]))
# check for UNIQUE indexes
c = self.execute("PRAGMA index_list(" + table.name + ")", {})