Skip to content
Advertisement

How do I save scraped data to a MySQL database?

I have a python script that scrapes data from a job website. I want to save these scraped data to MySQL database but after writing the code, it connects to the database. Now after connecting, it doesn’t create table and as result couldn’t insert those data into the table. Please i need my code to store these scraped data to a table in the MYSQL database.

Here’s my code

JavaScript

Here’s the error I get

JavaScript

Advertisement

Answer

Slight issue with the column name. Instead of ‘Company Name’ it needs to be ‘Company_Name’. SQL doesn’t like spaces in column names. Updated queries that you should run:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement