title: how do i delete the contents of a table using python and mysql
body: <p>HI all i am trying to delete the contents of my tabel before entering new data and i cant seem to get it to work , i keep on getting a error or is there a better way then i am trying to do it, here is the code thank you all for your help in advance </p>
  
  <pre><code>import mysql.connector
  import pandas as pd
  import mysql.connector
  from mysql.connector import Error
  
  
  
  print ("Clearning Flight Data table for new data")
  
  
  try:
      connection = mysql.connector.connect(host='localhost',
                                           database='flightdata',
                                           user='root',
                                           password='*****')
      cursor = connection.cursor()
      Delete_all_rows = """flightinfo """
      cursor.execute(Delete_all_rows)
      connection.commit()
      print("All Record Deleted successfully ")
  
  except mysql.connector.Error as error:
      print("Failed to Delete all records from database table: {}".format(error))
  finally:
      if (connection.is_connected()):
          cursor.close()
          connection.close()
          print("MySQL connection is closed")
  
  
  print ("Running Sydney KWS Domestic update")
  import syd_kws_dom
  
  
  print ("Running Sydney KWS International update")
  import syd_kws_int
  </code></pre>