From 74553f426c23e42e05d9be19f4ed8ae411280b50 Mon Sep 17 00:00:00 2001 From: Rahul Priyadarshi Date: Wed, 17 Dec 2014 07:27:59 -0800 Subject: [PATCH] Use native sqlalchemy 0.9 quote attribute with ibmdb2 Commit 8d6ce64cd08c0598963a92844495782997cd59f3 started using the native quote attribute built into sqlalchemy 0.9 but missed the changes to the ibmdb2 changeset, so alter table statements fail for DB2 on sqlalchemy >= 0.9 (tested against 0.9.8). This fixes the same issue for the ibmdb2 changeset. Change-Id: Ia3fa6c3090b5eab29ed7746f4795d502990b8a2f --- migrate/changeset/databases/ibmdb2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/migrate/changeset/databases/ibmdb2.py b/migrate/changeset/databases/ibmdb2.py index e583bd4..7b6a3a1 100644 --- a/migrate/changeset/databases/ibmdb2.py +++ b/migrate/changeset/databases/ibmdb2.py @@ -14,6 +14,7 @@ from sqlalchemy.schema import (Index, from migrate.changeset import ansisql from migrate.changeset import constraint +from migrate.changeset import util from migrate import exceptions @@ -107,7 +108,8 @@ class IBMDBSchemaChanger(IBMDBSchemaGenerator, ansisql.ANSISchemaChanger): """Rename a table; #38. Other ops aren't supported.""" self._rename_table(table) - self.append("TO %s" % self.preparer.quote(table.new_name, table.quote)) + q = util.safe_quote(table) + self.append("TO %s" % self.preparer.quote(table.new_name, q)) self.execute() self.append("COMMIT") self.execute() @@ -128,10 +130,11 @@ class IBMDBSchemaChanger(IBMDBSchemaGenerator, ansisql.ANSISchemaChanger): def _run_subvisit(self, delta, func, start_alter=True): """Runs visit method based on what needs to be changed on column""" table = delta.table + q = util.safe_quote(table) if start_alter: self.start_alter_table(table) ret = func(table, - self.preparer.quote(delta.current_name, delta.quote), + self.preparer.quote(delta.current_name, q), delta) self.execute() self._reorg_table(self.preparer.format_table(delta.table))