Bug #97813 | Wont fully import CSV file. | ||
---|---|---|---|
Submitted: | 27 Nov 2019 13:40 | Modified: | 31 Dec 2019 7:35 |
Reporter: | Brandon Hoffman | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Workbench: SQL Editor | Severity: | S1 (Critical) |
Version: | 8.0.18,8.0.20, 8.0.28 | OS: | Windows (10) |
Assigned to: | CPU Architecture: | x86 (quad core 2.2 ghz) | |
Tags: | .csv file, importing, workbench 8 |
[27 Nov 2019 13:40]
Brandon Hoffman
[27 Nov 2019 13:51]
Brandon Hoffman
final failing result
Attachment: final.PNG (image/png, text), 85.58 KiB.
[27 Nov 2019 13:51]
Brandon Hoffman
creating a new table
Attachment: newtablecreation.PNG (image/png, text), 31.44 KiB.
[27 Nov 2019 13:52]
Brandon Hoffman
showing the correct filepath
Attachment: selected.PNG (image/png, text), 10.92 KiB.
[27 Nov 2019 13:52]
Brandon Hoffman
showing schema without the table present
Attachment: withouttable.PNG (image/png, text), 44.37 KiB.
[2 Dec 2019 8:50]
Brandon Hoffman
An update. I have tried saving the file in UTf-8 CSV, and that did not work. I tried to changed encoding to Latin1 and others and still did not work. I also realized that the file had so many records that it truncated with an error. After investigation is there a way to import the .csv file with the option to stop truncation. Or is there a place where the truncation limit can be set. Can this be turned into a feature?
[3 Dec 2019 7:31]
MySQL Verification Team
Hello Brandon Hoffman, Thank you for the report. To investigate further this issue at our end, may I kindly request you to provide the .csv file? Thank you. Regards, Ashwini Patil
[4 Dec 2019 6:42]
Brandon Hoffman
failing file
Attachment: em_thk_tooling.csv (application/vnd.ms-excel, text), 42.03 KiB.
[4 Dec 2019 6:46]
Brandon Hoffman
Update: I tried to see if it is the file size or record limit by dissecting the file into 6 smaller files with only 249 records to see if that made a difference, did not. Some thing is wrong with data that I cant tell or Workbench is not working properly.
[31 Dec 2019 7:35]
MySQL Verification Team
Hello Brandon Hoffman, Thank you for the requested details. Regards, Ashwini Patil
[29 Jun 2020 11:47]
MySQL Verification Team
Bug #99733 marked as duplicate of this one.
[5 Jun 2021 1:12]
Yunong Han
dataset
Attachment: data-large.csv (application/vnd.ms-excel, text), 958.70 KiB.
[23 Sep 2021 19:32]
Christopher Chern
I am surprised to see no solution provided for this issue.
[21 Mar 2022 17:00]
lala sd
you guys are really doodoo, go and check yourself if your duplicate big has solution provided by you. shame on you Oracle dammn i just cant understand you guys just labeling as duplicate instead of providing solution i am switching on microsoft sql shitty product sql u have by the the duplicate u said dont have any solution in there
[28 Mar 2022 5:41]
MySQL Verification Team
Hello, Thank you for writing us. We once again revisited your issue internally with WB coordinator and concluded below points. A CSV file contains strings of characters. Even if they appear numeric, they are still characters, not numbers. Consider a CSV file that contains: "What follows is a string, even though there are no quotes:",1 Examine the bytes stored in that file, and you'll see that the last value is not something like 0x01, but rather 0x31, which is the code for the character "1". The import wizard looks at the first few rows of data in the CSV, sees some numeric characters with no quote marks, and guesses that field is supposed to represent a double. If you insert a string into a numeric type like int or double, MySQL follows the rules documented at <https://dev.mysql.com/doc/refman/8.0/en/type-conversion.html> for converting a string into a number. At line 24 in the file you've attached(em_thk_tooling.csk), the value provided for one of those "double" fields is an empty string. 24,0.5,double d,0.13,0.232,, An empty string has no exact numeric equivalent. It's not 0; that's a number with a string representation "0", and is the answer to "How many pink elephants are tap dancing in your living room right now?". It's not NULL, because we represent that with \N and is the answer to "What is the number of your bank account?" (there is such a number, but my answer is "I won't tell you", which you can record as NULL, meaning "unknown"). It isn't a number at all. It's just empty. Years ago, MySQL's default behavior was to try to accept these ambiguities and just use the default value for that column type. Users liked that when it made their imports run quietly, but didn't like it when they couldn't tell the difference between a provided "0" value and a missing value. So, we now use "strict" mode as default: if you provide a value that doesn't fit the column type, MySQL gives an error, which lets you know right away that something went wrong, so you can decide what to do. Three possible choices: 1. You can fix the CSV file so that it doesn't have empty strings where numeric digits are supposed to be. Put a 0 there, or \N if you want it to be NULL. 2. You can change the column type for that field to TEXT, which is happy to store empty strings. Later you can go back and update those empty strings to be strings of "0" or NULL or whatever, and then change the column type to FLOAT or DOUBLE or DECIMAL. 3. You can SET GLOBAL sql_mode=''; before opening the connection that will run the wizard, which tells MySQL to pretend it's 1999 and just accept whatever you hand it and do its best to convert values to what you might or might not have meant. Regards, Ashwini Patil