First, we will display the data to be modified by running the following Python to MySQL command:
import MySQLdb as mysql import Ch07_Code.GuiDBConfig as guiConf class MySQL(): # class variable GUIDB = 'GuiDB' #------------------------------------------------------ def showData(self): # connect to MySQL conn, cursor = self.connect() self.useGuiDB(cursor) # execute command cursor.execute("SELECT * FROM books") print(cursor.fetchall()) cursor.execute("SELECT * FROM quotations") print(cursor.fetchall()) # close cursor and connection self.close(cursor, conn) #========================================================== if __name__ == '__main__': # Create class instance mySQL = MySQL() mySQL.showData()
Running the ...