In MySQL Workbench, using the table data import wizard to import CSV creates an empty table

I am trying to import a csv file into a MySQL table using the table data import wizard. The sample section at the bottom of the “Configure Import Settings” screen looks good, and when I start the import, it says that all my records have been downloaded successfully. However, when I turn to viewing the contents of the table, there are only columns, and not one of my actual data is loaded. Does anyone know why this can happen and how to fix it?

EDIT:

These are a few lines from my CSV file:

STATION, STATION_NAME, ELEVATION, LATITUDE, LONGITUDE, DATE, MLY-TAVG-NORMAL, MLY-TMAX-NORMAL, MLY-TMIN-NORMAL, Average Temp, Max Temp, Min Temp GHCND: USW00094085, PIERRE 24 S SD US, 647, 4.44.0194, -100.353,201001,218,322,113,21.8,32.2,11.3 GHCND: USW00094085, PIERRE 24 S SD US, 647,4,444,194, -100.353,201002,246,354,137,24.6,35.4,13.7 GHCND: USW00094085, PIERRE 24 S SD US, 647,4,444.0194, -100.353,201003,339,451,226,33.9,45.1,22.6 GHCND: USW00094085, PIERRE 24 S SD USA, 647,4, 4,0194, -100,352,20000,446,585,337,46,3 , 58.8.33.7 GHCND: USW00094085, PIERRE 24 S SD US, 647,4,44.0194, -100.353,201005,573,696,450,57.3,69.6,45

Here are some images of the import process: Image1

Image2

Image3

Image4

Image5

Image6

And this is what I see when I try to view a newly created table: Image7

Second edit:

Here is an image of my settings:

Settings

And here is an image of my CSV file showing line endings:

enter image description here

+5
source share
3 answers

Check the encoding of your file. When parsing the source file as UTF-8, the workstation explodes soundlessly when it encounters non-UTF-8 characters. I used cp1250 (windows 1250) for a file exported from Excel, and everything worked correctly.

+4
source

You need to make sure your csv options are set correctly when importing the table.

When you get to the bottom screen, pay attention to how the red arrow points to the key. By clicking on this option, you can set the line separator, include lines and field separator. If they are not installed correctly, the data will fail to load.

enter image description here

The following is an example CSV file. Note that in Notepad ++, the cover button is pressed so that you can see the end of the line. In this case, the end of the line is CR LF . The default setting for the Workbench Import Wizard is LF . In addition, the default field separator looks like ; but not,.

enter image description here

You can read more here on dev.mysql

0
source

Tried your sample data and it imported a fine. I think something is wrong with further data. Perhaps one (or more) entries is not as it should be. The preview is good for the first number of records, so your import definition seems fine. Try importing smaller pieces of records. Start with 1, continue to ten, etc. Until you see that the import failed. You can also try with only one column, and if it succeeds in doing a binary search for a column that does not work.

Note: an error appears when displaying imported rows (and has been fixed for the next version). This always shows the total number of records, not imported ones.

0
source

Source: https://habr.com/ru/post/1232761/


All Articles