嗨,在输入新数据之前,我试图删除我的标签的内容,但似乎无法使其正常工作,我不断地收到错误,或者有更好的方法,然后我试图这样做,这是代码,谢谢大家提前帮助
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