This is my table:
CREATE TABLE `products` (
`productID` bigint NOT NULL AUTO_INCREMENT,
`designID` bigint DEFAULT '0',
`qualityID` bigint DEFAULT '0',
`brandName` varchar(50) NOT NULL,
`brandNameId` bigint NOT NULL DEFAULT '0',
`brandCounter` int NOT NULL,
`productName` varchar(255) DEFAULT NULL,
`mainCategoryId` int NOT NULL DEFAULT '0',
`subCategoryId` int NOT NULL DEFAULT '0',
`setConfiguration` int NOT NULL DEFAULT '0',
`isCombo` int NOT NULL DEFAULT '0',
`description` text,
`isLeather` tinyint(1) NOT NULL DEFAULT '0',
`isCutSizeAvailable` tinyint(1) NOT NULL DEFAULT '0',
`soleType` varchar(35) DEFAULT NULL,
`moqPairs` int NOT NULL,
`moqSets` int NOT NULL,
`minLeadTime` int NOT NULL,
`maxLeadTime` int NOT NULL,
`price` double(10,2) NOT NULL,
`sellerPrice` double(10,2) NOT NULL DEFAULT '0.00',
`transferPrice` double(15,6) DEFAULT '0.000000',
`margin` double(8,4) NOT NULL,
`marginAmt` double(7,2) DEFAULT '0.00',
`tax` double(8,4) NOT NULL DEFAULT '0.0000',
`taxAmt` double(7,2) NOT NULL DEFAULT '0.00',
`tcs` double(5,4) NOT NULL DEFAULT '0.0100',
`tcsAmt` double(7,2) NOT NULL DEFAULT '0.00',
`transferValue` double(10,2) NOT NULL DEFAULT '0.00',
`skPrice` double(10,2) NOT NULL DEFAULT '0.00',
`warrenty` varchar(256) NOT NULL,
`defImage` varchar(256) NOT NULL,
`sellerID` int NOT NULL,
`parseID` varchar(15) DEFAULT NULL,
`createdOn` int NOT NULL,
`updatedOn` int DEFAULT NULL,
`setSizes` varchar(16) DEFAULT '8',
`styleTag` varchar(50) DEFAULT NULL,
`matUpper` varchar(50) DEFAULT NULL,
`matInsock` varchar(50) DEFAULT NULL,
`matLining` varchar(50) DEFAULT NULL,
`matHeel` varchar(50) DEFAULT NULL,
`mrp` double(10,2) DEFAULT '0.00',
`searchKeywords` varchar(512) DEFAULT NULL,
`subSellerId` int DEFAULT NULL,
`isChangeRequested` tinyint(1) DEFAULT '0',
`changeRequestedOn` int DEFAULT NULL,
`isSKAssured` int NOT NULL DEFAULT '0',
`sizeChartID` int DEFAULT NULL,
`lastApprovedOn` int DEFAULT NULL,
`alterationMessage` text,
`alterationStatus` int DEFAULT NULL,
`soleTypeId` bigint DEFAULT '0',
`isSubmitted` int DEFAULT '0',
`submittedOn` int DEFAULT NULL,
`isApproved` int DEFAULT '0',
`hidden` int NOT NULL,
`approvedOn` int NOT NULL DEFAULT '0',
`isRejected` int DEFAULT '0',
`rejectedOn` int DEFAULT '0',
`rejectedRemarks` text,
`hsnCode` varchar(10) DEFAULT NULL,
`styleTagID` bigint DEFAULT '0',
`taxOnMargin` double(8,2) NOT NULL DEFAULT '0.00',
`taxOnMarginAmt` double(8,2) NOT NULL DEFAULT '0.00',
`lotSize` int NOT NULL,
`sellsType` int NOT NULL DEFAULT '0',
`sizeStandard` int NOT NULL DEFAULT '0',
`cartonType` int NOT NULL,
`multipleColors` int DEFAULT NULL,
`limitedCartonStatus` tinyint(1) NOT NULL DEFAULT '1',
`limitedCarton` int DEFAULT NULL,
`leadTime` int DEFAULT NULL,
`weight` int DEFAULT NULL,
`packaging` tinyint(1) NOT NULL DEFAULT '0',
`imported` tinyint(1) NOT NULL DEFAULT '0',
`productDescription` text,
`platform` varchar(50) NOT NULL,
`countryOrigin` varchar(20) DEFAULT NULL,
`status` int NOT NULL DEFAULT '0' COMMENT '0=> Draft 1=>Approved 2=>InReview 3=>InApprovedReview 4=>Removed',
`currentStage` varchar(255) DEFAULT NULL,
`currentStageValue` json DEFAULT (json_object()),
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`gradeID` bigint DEFAULT NULL,
`designType` varchar(200) DEFAULT NULL,
`createdBy` bigint DEFAULT NULL,
`createdByType` varchar(200) DEFAULT NULL,
`productOwner` enum('BRAND','BRAND_AGGREGATOR_GRADE','BRAND_AGGREGATOR_DESIGN','BRAND_TRADING') NOT NULL,
PRIMARY KEY (`productID`),
UNIQUE KEY `CompositeKey` (`brandNameId`,`brandCounter`),
KEY `sellerID` (`sellerID`),
KEY `isApproved` (`isApproved`),
KEY `approvedOn` (`approvedOn`),
KEY `brandNameId` (`brandNameId`),
KEY `skPrice` (`skPrice`),
KEY `soleTypeId` (`soleTypeId`),
KEY `styleTagID` (`styleTagID`),
KEY `brandName` (`brandName`,`brandCounter`),
KEY `brandName_2` (`brandName`),
KEY `brandCounter` (`brandCounter`),
KEY `sellsType` (`sellsType`),
KEY `moqPairs` (`moqPairs`,`isApproved`,`approvedOn`),
KEY `brandCounter_2` (`brandCounter`,`moqPairs`,`isApproved`,`approvedOn`,`sellsType`),
KEY `productID_2` (`productID`,`isApproved`,`approvedOn`),
KEY `productID` (`productID`,`sellerID`,`isApproved`,`approvedOn`,`brandNameId`) USING BTREE,
KEY `brandNameId_2` (`brandNameId`,`sellerID`),
KEY `brandNameId_3` (`brandNameId`,`sellerID`,`isApproved`,`approvedOn`),
KEY `mainCategoryId` (`mainCategoryId`),
KEY `subCategoryId` (`subCategoryId`),
KEY `hid_ix` (`hidden`),
KEY `grade_index` (`gradeID`),
KEY `created_by_index` (`createdBy`),
KEY `updatedOnIdx` (`updatedOn`),
KEY `updatedAtidx` (`updated_at`),
KEY `designTypeIdx` (`designType`),
KEY `design_index` (`designID`),
KEY `quality_index` (`qualityID`),
KEY `productName_index` (`productName`),
FULLTEXT KEY `product_name_idx` (`productName`)
) ENGINE=InnoDB AUTO_INCREMENT=2066613 DEFAULT CHARSET=utf8mb3;
I added ‘BRAND_TRADING’ in the enum in productOwner col but on inserting or updating any row i am getting this:
(pymysql.err.DataError) (1265, "Data truncated for column 'productOwner' at row 1")n[SQL: INSERT INTO products (`designID`, `qualityID`, `brandName`, `brandNameId`, `brandCounter`, `productName`, `mainCategoryId`, `subCategoryId`, `setConfiguration`, `isCombo`, description, `isLeather`, `isCutSizeAvailable`, `soleType`, `moqPairs`, `moqSets`, `minLeadTime`, `maxLeadTime`, price, `sellerPrice`, `transferPrice`, margin, `marginAmt`, tax, `taxAmt`, tcs, `tcsAmt`, `transferValue`, `skPrice`, warrenty, `defImage`, `sellerID`, `parseID`, `createdOn`, `updatedOn`, `setSizes`, `styleTag`, `matUpper`, `matInsock`, `matLining`, `matHeel`, mrp, `searchKeywords`, `subSellerId`, `isChangeRequested`, `changeRequestedOn`, `isSKAssured`, `sizeChartID`, `lastApprovedOn`, `alterationMessage`, `alterationStatus`, `soleTypeId`, `isSubmitted`, `submittedOn`, `isApproved`, hidden, `approvedOn`, `isRejected`, `rejectedOn`, `rejectedRemarks`, `hsnCode`, `styleTagID`, `taxOnMargin`, `taxOnMarginAmt`, `lotSize`, `sellsType`, `sizeStandard`, `cartonType`, `multipleColors`, `limitedCartonStatus`, `limitedCarton`, `leadTime`, weight, packaging, imported, `productDescription`, platform, `countryOrigin`, status, `currentStage`, `currentStageValue`, `createdBy`, `designType`, `createdByType`, `productOwner`) VALUES (%(designID)s, %(qualityID)s, %(brandName)s, %(brandNameId)s, %(brandCounter)s, %(productName)s, %(mainCategoryId)s, %(subCategoryId)s, %(setConfiguration)s, %(isCombo)s, %(description)s, %(isLeather)s, %(isCutSizeAvailable)s, %(soleType)s, %(moqPairs)s, %(moqSets)s, %(minLeadTime)s, %(maxLeadTime)s, %(price)s, %(sellerPrice)s, %(transferPrice)s, %(margin)s, %(marginAmt)s, %(tax)s, %(taxAmt)s, %(tcs)s, %(tcsAmt)s, %(transferValue)s, %(skPrice)s, %(warrenty)s, %(defImage)s, %(sellerID)s, %(parseID)s, %(createdOn)s, %(updatedOn)s, %(setSizes)s, %(styleTag)s, %(matUpper)s, %(matInsock)s, %(matLining)s, %(matHeel)s, %(mrp)s, %(searchKeywords)s, %(subSellerId)s, %(isChangeRequested)s, %(changeRequestedOn)s, %(isSKAssured)s, %(sizeChartID)s, %(lastApprovedOn)s, %(alterationMessage)s, %(alterationStatus)s, %(soleTypeId)s, %(isSubmitted)s, %(submittedOn)s, %(isApproved)s, %(hidden)s, %(approvedOn)s, %(isRejected)s, %(rejectedOn)s, %(rejectedRemarks)s, %(hsnCode)s, %(styleTagID)s, %(taxOnMargin)s, %(taxOnMarginAmt)s, %(lotSize)s, %(sellsType)s, %(sizeStandard)s, %(cartonType)s, %(multipleColors)s, %(limitedCartonStatus)s, %(limitedCarton)s, %(leadTime)s, %(weight)s, %(packaging)s, %(imported)s, %(productDescription)s, %(platform)s, %(countryOrigin)s, %(status)s, %(currentStage)s, %(currentStageValue)s, %(createdBy)s, %(designType)s, %(createdByType)s, %(productOwner)s)]n[parameters: {'designID': 0, 'qualityID': 0, 'brandName': 'test', 'brandNameId': '1001175', 'brandCounter': 53, 'productName': 'test 053', 'mainCategoryId': '1000020', 'subCategoryId': '1003447', 'setConfiguration': 1, 'isCombo': 0, 'description': None, 'isLeather': 0, 'isCutSizeAvailable': 0, 'soleType': None, 'moqPairs': 3, 'moqSets': 3, 'minLeadTime': 0, 'maxLeadTime': 0, 'price': 0, 'sellerPrice': 0, 'transferPrice': 0, 'margin': 0, 'marginAmt': '0.00', 'tax': 0, 'taxAmt': 0, 'tcs': '0.0100', 'tcsAmt': '0.00', 'transferValue': 0, 'skPrice': 0, 'warrenty': 1, 'defImage': 'https://bijnis.s3.amazonaws.com/PRODUCTION/uploads/uploadfile_1-2e496e1b-d002-40f9-bdd0-030e3e329203.jpg', 'sellerID': '1490486208', 'parseID': None, 'createdOn': 1715713458, 'updatedOn': None, 'setSizes': '8', 'styleTag': None, 'matUpper': None, 'matInsock': None, 'matLining': None, 'matHeel': None, 'mrp': 0, 'searchKeywords': '', 'subSellerId': None, 'isChangeRequested': '0', 'changeRequestedOn': None, 'isSKAssured': '0', 'sizeChartID': 0, 'lastApprovedOn': None, 'alterationMessage': None, 'alterationStatus': None, 'soleTypeId': '0', 'isSubmitted': 1, 'submittedOn': 1715713458, 'isApproved': 1, 'hidden': 0, 'approvedOn': 1715713458, 'isRejected': '0', 'rejectedOn': 0, 'rejectedRemarks': None, 'hsnCode': '878776', 'styleTagID': '0', 'taxOnMargin': '0.00', 'taxOnMarginAmt': '0.00', 'lotSize': 3, 'sellsType': 1, 'sizeStandard': 1, 'cartonType': 0, 'multipleColors': 1, 'limitedCartonStatus': 0, 'limitedCarton': None, 'leadTime': None, 'weight': 0, 'packaging': '0', 'imported': '0', 'productDescription': None, 'platform': 'web', 'countryOrigin': 'India', 'status': 1, 'currentStage': 'LAUNCHED', 'currentStageValue': '{"launched": {"launchedBy": "1490488311", "launchedOn": "2024-05-15 00:34:18.318600"}, "productApproved": [{"approvedBy": "1490488311", "approvedOn": "2024-05-15 00:34:18"}]}', 'createdBy': '1490488311', 'designType': None, 'createdByType': 'Seller', 'productOwner': 'BRAND_TRADING'}]n(Background on this error at: https://sqlalche.me/e/14/9h9h)
I have tried following approaches based on answers for similar problems:
- altering the col as VARCHAR(30) but the problem still persists (same error)
- creating a new col named productOwnerNew (tried with both as VARCHAR and enum with new value) and dumping data from productOwner, here I was able to add/edit the row but when I changed the col name productOwnerNew -> productOwner and productOwner -> productOwnerOld again I was not able to add/edit col as ‘BRAND_TRADING’ (tried with other random strings too) and getting the same error but interestingly i was able to add/edit the now productOwnerOld col
- checked the triggers, constraints, FK: no change such things on the column, there was a index but i removed it just in case before taking above approaches
- checked the sql_mode it is set as ”