Not the best with MySQL, but I'm scraping data from websites with python, and storing the results in a mysql database. All the data I've collected have been placed into custom objects that I created (i.e each object is a car with a respective make, model, year, etc.) Now where I'm having an issue is that each car has a number of images associated with it, and it can range from zero to ten images. The question I have is how can I store these images in a MySQL table and connect it to its respective car.
This is the table I've created for each car so far (python code):
command = ("""CREATE TABLE `%s`(
`auctionHouse` varchar(255) NOT NULL,
`auction` varchar(255) NOT NULL,
`lot` varchar(255) NOT NULL,
`year` int,
`make` varchar(255) NOT NULL,
`model` varchar(255),
`description` text,
`fullName` varchar(255) NOT NULL,
`salePrice` varchar(255),
`highPrice` int NOT NULL,
PRIMARY KEY (`auction`,`lot`));
"""
)%(auction)
Do I have to create another table for holding images and then when I query the car, use a join?