Use native sqlalchemy 0.9 quote attribute with ibmdb2

Commit 8d6ce64cd0 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
This commit is contained in:
Rahul Priyadarshi 2014-12-17 07:27:59 -08:00 committed by Matt Riedemann
parent 244c6c55d7
commit 74553f426c

View File

@ -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))