Jump to content

Importing Data & mapping from CSV files


balkrishna

Recommended Posts

Indeed. Use your database for what it's good at; create a table that has the exact columns of the CSV and use LOAD DATA INFILE to fill it with the CSV data.

Then use separate queries to copy the data from that table to your actual database. This way you can check if the CSV has loaded correctly without having to parse the data, and you can easily manipulate the data where needed. (like remove duplicates, find empty fields, etc)

 

The reasing behind this method is that you can use one query to check/change all records. If the data in the new table passes a handfull of sanitycheck queries, you're good to import it for real.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.