I am creating table like in tutorial for mysql.connector via dict
TABLES[name] = (
f"CREATE TABLE `{name}` ("
" `product_id` int(11) NOT NULL AUTO_INCREMENT,"
" `Product name` varchar(255) NOT NULL,"
" `Seller name` varchar(255) NOT NULL,"
" `Image link` varchar(255)) NOT NULL,"
" `Original price` decimal(6,2) NOT NULL,"
" `Discount` varchar(10) NOT NULL,"
" `Description` text NOT NULL,"
" `Actual price` decimal(6,2) NOT NULL,"
" `product URL` varchar(255) NOT NULL,"
" `Rating score` decimal(1,15) NOT NULL,"
" `Reviews` int(5) NOT NULL,"
" `ItemId` int(11) NOT NULL,"
" `InStock` int(1) NOT NULL,"
" `ColorFamily` int(1) NOT NULL,"
" PRIMARY KEY (`product_id`)"
") ENGINE=InnoDB")
TABLES[colorname] = (
f"CREATE TABLE `{colorname}` ("
" `item_no` int(11) NOT NULL AUTO_INCREMENT,"
" `product_id` int(11) NOT NULL,"
" `ColorName` varchar(255) NOT NULL,"
" `ColorPrice` decimal(6,2) NOT NULL,"
" PRIMARY KEY (`item_no`)"
f" CONSTRAINT `{colorname}_ibfk_1` FOREIGN KEY (`product_id`) "
f" REFERENCES `{name}` (`product_id`) ON DELETE CASCADE"
") ENGINE=InnoDB")
and I get
Creating table Women sunglasses: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL,
Original price
decimal(6,2) NOT NULL,Discount
varchar(10) NOT N' at line 1
Creating table Women sunglasses colorFamily: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT
Women sunglasses colorFamily_ibfk_1
FOREIGN KEY (product_id
) ' at line 1
What is not correct there?