This is my table and I want to insert an image in it but I get the error "Field 'storing' doesn't have a default value" Mysql doc says that blob doesnt want a defaul value mysql> show columns from cover; +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+----------------+ | idx | smallint | NO | | NULL | | | nomefile | varchar(255) | YES | | NULL | | | sizefile | varchar(255) | YES | | NULL | | | mimetype | varchar(255) | YES | | NULL | | | storing | blob | NO | | NULL | | | id | smallint | NO | PRI | NULL | auto_increment | +----------+--------------+------+-----+---------+----------------+ 6 rows in set (0,01 sec) def add_image(self, idx): options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog fileName, _ = QFileDialog.getOpenFileName(self, "Open Image", "/media/hdb1/", "Images (*.png *.xpm *.jpg)", options=options) query = "SELECT * FROM `cover` WHERE idx = %s " % (idx) if fileName: #This is just in case you need to manually delete the row in the table 'cover' conn, cursor = Functions.openDB(self, dbname) cursor.execute(query) nbrrows = cursor.rowcount if nbrrows == 0: query = "INSERT INTO `cover` (idx) VALUES (%s)" %(idx) <--- Below error is from this line cursor.execute(query) conn.commit() info = QFileInfo(fileName) size = info.size() base = info.completeBaseName() ext = info.completeSuffix() name = base + '.' +ext image = open(fileName, 'rb').read() # open binary file in read mode conn, cursor = Functions.openDB(self, dbname) mime = 'image/jpeg' query = "UPDATE `cover` SET nomefile = %s, sizefile = %s, mimetype = %s, storing = %s WHERE idx = %s " try: cursor.execute(query,(fileName, size, mime, image, idx)) conn.commit() except Error as e: Functions.handle_error(self, message=e) self.container.close() return Functions.message_handler(self,"Cover inserita correttamente") self.container.close() else: Functions.message_handler(self,"LEAVING EVERYTHING\nBYE BYE") self.container.close() And this is the error I get Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/mysql/connector/connection_cext.py", line 661, in cmd_query self._cmysql.query( _mysql_connector.MySQLInterfaceError: Field 'storing' doesn't have a default value The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Projects/personal/library_read.py", line 259, in <lambda> image_btn.clicked.connect(lambda connect: self.add_image(idx)) File "/Projects/personal/library_read.py", line 299, in add_image cursor.execute(query) File "/usr/local/lib/python3.10/dist-packages/mysql/connector/cursor_cext.py", line 374, in execute result = self._cnx.cmd_query( File "/usr/local/lib/python3.10/dist-packages/mysql/connector/opentelemetry/context_propagation.py", line 74, in wrapper return method(cnx, *args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/mysql/connector/connection_cext.py", line 669, in cmd_query raise get_mysql_exception( mysql.connector.errors.DatabaseError: 1364 (HY000): Field 'storing' doesn't have a default value Continue reading...