how to extract data from database using python?
['connect to the mySQL database.', 'select the relevant table using a sql query.', 'open a text file and write the content from the database.', 'loop over the code and do this for each table.']