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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.