What is the alternative of mysqlcheck in python3?

Viewed 31

I need to use mysqlcheck cmd for optimizing tables in the database. I've created a Lambda function in python for the whole process, now to execute the whole process first I need to optimize all tables of the database.

I'm using PyMSQL module in python for connecting DB, but I guess optimising tables ability is not provided by PyMSQL, Then I tried to use the subprocess module to run the OS command mysqlcheck, but got the following error:

[ERROR] FileNotFoundError: [Errno 2] No such file or directory: 'mysqlcheck'

Can you tell me is any alternative of mysqlcheck is present in python Or how i can run mysqlcheck CMD in AWS Lambda?

Thank You.

1 Answers

The alternative is to move your tables away from ENGINE=MyISAM (which sometimes needs OPTIMIZE) to ENGINE=InnoDB (which takes care if itself).

Related