To retrieve data from a database we have to make use of the module available for that database.
For MySQL database, we import MySQLdb module in our Python script.
We have to first connect to a specific database by passing URL, username, password and the name of database.
Once we establish the connection, we can open a cursor with cursor() function.
On an open cursor, we can run fetch() function to execute queries and retrieve data from the database tables.
Leave a Reply