diff options
author | Thomas Goirand <thomas@goirand.fr> | 2014-03-02 14:03:51 +0800 |
---|---|---|
committer | Sean Dague <sean.dague@samsung.com> | 2014-03-05 08:20:49 -0500 |
commit | 8d6ce64cd08c0598963a92844495782997cd59f3 (patch) | |
tree | 0c07f11aa7d36b01223d87ffea0e94c4ff0412f6 /migrate/changeset/databases/mysql.py | |
parent | bcb699161546105392ca7b83462a4666130715cd (diff) | |
download | sqalchemy-migrate-8d6ce64cd08c0598963a92844495782997cd59f3.tar.gz |
Use native quote attribute introduced in sqla 0.9
In SQLA 0.9 there is now a native .quote attribute on many objects.
Conditionally use this instead of the old method if the attribute
exists, to remove deprecation messages (and prepare for when the
other way will be fully removed).
Change-Id: I3c5fada13e044c1c4102acc0455226ce1524f2e2
Diffstat (limited to 'migrate/changeset/databases/mysql.py')
-rw-r--r-- | migrate/changeset/databases/mysql.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/migrate/changeset/databases/mysql.py b/migrate/changeset/databases/mysql.py index 6987b4b..29518e2 100644 --- a/migrate/changeset/databases/mysql.py +++ b/migrate/changeset/databases/mysql.py @@ -2,11 +2,14 @@ MySQL database specific implementations of changeset classes. """ +import sqlalchemy from sqlalchemy.databases import mysql as sa_base from sqlalchemy import types as sqltypes from migrate import exceptions from migrate.changeset import ansisql +from migrate.changeset import util + MySQLSchemaGenerator = sa_base.MySQLDDLCompiler @@ -34,7 +37,8 @@ class MySQLSchemaChanger(MySQLSchemaGenerator, ansisql.ANSISchemaChanger): first = primary_keys.pop(0) if first.name == delta.current_name: colspec += " AUTO_INCREMENT" - old_col_name = self.preparer.quote(delta.current_name, table.quote) + q = util.safe_quote(table) + old_col_name = self.preparer.quote(delta.current_name, q) self.start_alter_table(table) |