Skip to content

Commit f008e4e

Browse files
committed
use_innodb | in MySQL 8.0 information_schema tables columns are uppercase
1 parent 03d3a75 commit f008e4e

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

indexdigest/linters/linter_0036_use_innodb.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ def check_use_innodb(database):
1111
:type database indexdigest.database.Database
1212
:rtype: list[LinterEntry]
1313
"""
14-
res = database.query_dict_rows("SELECT table_name, engine FROM information_schema.tables "
15-
"WHERE engine <> 'InnoDB' and table_schema = '{}'".
14+
# in MySQL 8.0 information_schema tables columns are uppercase
15+
res = database.query_dict_rows("SELECT TABLE_NAME, ENGINE FROM information_schema.tables "
16+
"WHERE ENGINE <> 'InnoDB' and TABLE_SCHEMA = '{}'".
1617
format(database.db_name))
1718

1819
for row in res:
1920
context = OrderedDict()
20-
context['schema'] = database.get_table_schema(row['table_name'])
21-
context['engine'] = row['engine']
21+
context['schema'] = database.get_table_schema(row['TABLE_NAME'])
22+
context['engine'] = row['ENGINE']
2223

23-
yield LinterEntry(linter_type='use_innodb', table_name=row['table_name'],
24-
message='"{table_name}" uses {engine} storage engine'.
24+
yield LinterEntry(linter_type='use_innodb', table_name=row['TABLE_NAME'],
25+
message='"{TABLE_NAME}" uses {ENGINE} storage engine'.
2526
format(**row),
2627
context=context)

0 commit comments

Comments
 (0)