Я получаю ошибку ниже
"Не удалось вставить данные BLOB в таблицу MySQL 2006 (HY000): MySQL сервер пропал"
def insertBLOB(request):
id =(1)
name=("Eric")
photo = ("/home/gauri/Pictures/w3schools.jpg")
biodata = ("/home/gauri/Downloads/mnum.npy")
try:
connection = mysql.connector.connect(host="127.0.0.1", user="root", passwd="",
port=3307, db="data2")
cursor = connection.cursor()
sql_insert_blob_query = "INSERT INTO python_employee(id, name, photo, biodata)
VALUES (%s,%s,%s,%s)"
with open(photo, 'rb') as file:
binaryData = file.read()
with open(biodata, 'rb') as file:
binaryData1 = file.read()
insert_blob_tuple = (id, name, binaryData, binaryData1,)
result = cursor.execute(sql_insert_blob_query,insert_blob_tuple)
connection.commit()
print("Image and file inserted successfully as a BLOB into python_employee
table",result)
except mysql.connector.Error as error:
print("Failed inserting BLOB data into MySQL table {}".format(error))
return HttpResponse("data")