From a966505992b94ec1cc0633aafa7dda0a287fb96c Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Tue, 17 Jul 2007 20:13:36 +0000 Subject: Properly escape table names when reflecting for mssql and sqlite [ticket:653] --- lib/sqlalchemy/databases/sqlite.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/databases/sqlite.py') diff --git a/lib/sqlalchemy/databases/sqlite.py b/lib/sqlalchemy/databases/sqlite.py index b42468c7a..5c4a38b5d 100644 --- a/lib/sqlalchemy/databases/sqlite.py +++ b/lib/sqlalchemy/databases/sqlite.py @@ -233,7 +233,7 @@ class SQLiteDialect(ansisql.ANSIDialect): return (row is not None) def reflecttable(self, connection, table): - c = connection.execute("PRAGMA table_info(" + table.name + ")", {}) + c = connection.execute("PRAGMA table_info(%s)" % self.preparer().format_table(table), {}) found_table = False while True: row = c.fetchone() @@ -266,7 +266,7 @@ class SQLiteDialect(ansisql.ANSIDialect): if not found_table: raise exceptions.NoSuchTableError(table.name) - c = connection.execute("PRAGMA foreign_key_list(" + table.name + ")", {}) + c = connection.execute("PRAGMA foreign_key_list(%s)" % self.preparer().format_table(table), {}) fks = {} while True: row = c.fetchone() @@ -295,7 +295,7 @@ class SQLiteDialect(ansisql.ANSIDialect): for name, value in fks.iteritems(): table.append_constraint(schema.ForeignKeyConstraint(value[0], value[1])) # check for UNIQUE indexes - c = connection.execute("PRAGMA index_list(" + table.name + ")", {}) + c = connection.execute("PRAGMA index_list(%s)" % self.preparer().format_table(table), {}) unique_indexes = [] while True: row = c.fetchone() -- cgit v1.2.1