diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-01 21:20:59 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-03-01 21:20:59 +0000 |
commit | fd8d4a45ea1c2087ed3c4a86bf5f889b194fdb48 (patch) | |
tree | 5afc754c8c249c774f773476dd1d9518ad4b41e7 /lib/sqlalchemy/databases | |
parent | fd8567037269ac937a6b079c6e00022abfc51149 (diff) | |
download | sqlalchemy-fd8d4a45ea1c2087ed3c4a86bf5f889b194fdb48.tar.gz |
made SchemaEngine more prominent as the base of Table association
BaseProxyEngine descends from SchemaEngine
fixes to sqlite/postgres reflection to use the correct engine for table lookups
Table engine can be none which will default to schema.default_engine (although its
still positional for now, so still needs to be explicit to make room for Columns)
__init__ sets default_engine to be a blank ProxyEngine
fixes to test suite to allow --db proxy.<dbname> to really test proxyengine
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r-- | lib/sqlalchemy/databases/postgres.py | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/databases/sqlite.py | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/databases/postgres.py b/lib/sqlalchemy/databases/postgres.py index 13714ba3e..92407637f 100644 --- a/lib/sqlalchemy/databases/postgres.py +++ b/lib/sqlalchemy/databases/postgres.py @@ -199,7 +199,7 @@ class PGSQLEngine(ansisql.ANSISQLEngine): self.opts['port'] = str(self.opts['port']) ansisql.ANSISQLEngine.__init__(self, **params) - + def connect_args(self): return [[], self.opts] @@ -277,7 +277,9 @@ class PGSQLEngine(ansisql.ANSISQLEngine): else: ischema_names = pg1_ischema_names - ischema.reflecttable(self, table, ischema_names) + # give ischema the given table's engine with which to look up + # other tables, not 'self', since it could be a ProxyEngine + ischema.reflecttable(table.engine, table, ischema_names) class PGCompiler(ansisql.ANSICompiler): 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 + ")", {}) |