Created
February 29, 2012 04:14
-
-
Save adw0rd/1937616 to your computer and use it in GitHub Desktop.
Converter from MyISAM to InnoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connection | |
exclude_tables = ("example", ) | |
c = connection.cursor() | |
c.execute("SHOW TABLE STATUS WHERE ENGINE='MyISAM'") | |
for line in c.fetchall(): | |
table_name = line[0] | |
if table_name in exclude_tables: | |
continue | |
c.execute("ALTER TABLE `{}` ENGINE=InnoDB".format(table_name)) | |
print ">>> {} is converted!".format(table_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Можно в джанго-комаду это обернуть, но скорее больше не понадобится :)