0

I am looking for software to assist me in the process of converting CSV files into insert statements for MySQL. The software would ideally have the following characteristics:

  1. Be able to convert a large amount of CSV files at a time. I have ~2000 total and although they do not need to all be done at once I also do not wish to do them all one at a time.
  2. By basic SQL syntax I need to make it so that each insert statements begins with INSERT INTO Table "column1, column2...columnN" VALUE "value1, value2...valueN". However the CSV files contain the column headers in the first row and the rest of the data in subsequent rows. It must use the first row for the INSERT INTO statement that can be inserted before each row of VALUE statements below.
1

there's sqlizer.io (I work here) which is a web-based tool that does exactly as you're describing. Check it out (it's free for up to 5000 rows).

sqlizer.io csv to mysql statement

| improve this answer | |
  • Do not astroturf your own products. You are deliberately trying to make it sound as if you are not associated with this product: free for ... I believe. But elsewhere you clearly state you are directly associated with this product: we are super-cautious with security and wrote a blog post recently about how we operate SQLizer. See softwarerecs.stackexchange.com/help/promotion – Martijn Pieters Oct 1 '19 at 13:00
  • Could you please add your disclosure here as well (and to the other posts)? Thanks! – Izzy Oct 2 '19 at 20:03
1

I'd suggest you look at Data Transformer (disclaimer - I'm its developer). It can convert CSV/JSON/XML to SQL. The generated SQL contains "insert" statements for each line and a "create table" statement.

The app works offline, and your data never leaves your computer.

You can get it from the Mac App Store or the Microsoft Store.

| improve this answer | |
0

The "EXPORT...AS VALUES" metacommand of execsql.py (disclaimer: I wrote execsql) will create the kind of insert statement you're looking for. For that to work, however, you first have to IMPORT each CSV file--but maybe that's what you're ultimately trying to do anyway. One of the examples in execsql's documentation shows how to import all CSV files in a directory. If all you're really looking for is the insert statements, that example could be extended to "EXPORT...AS VALUES" each table after it is imported.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.