Bug #98868 At CSV import, the wizard breaks with specific input data
Submitted: 8 Mar 2020 0:42 Modified: 8 Mar 2020 6:00
Reporter: Pāvils Jurjāns Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.19 OS:Linux (Ubuntu 18.04 x86_64)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[8 Mar 2020 0:42] Pāvils Jurjāns
Description:
Here's the relevant excerpt from the log:

02:00:52 [ERR][       pymforms]: Unhandled exception in Python code:
Traceback (most recent call last):
  File "/usr/share/mysql-workbench/libraries/workbench/wizard_page_widget.py", line 97, in go_next
    self.main.go_next_page()
  File "/usr/share/mysql-workbench/libraries/workbench/wizard_form.py", line 76, in go_next_page
    self.pages[index].page_activated(True)
  File "/usr/lib/mysql-workbench/modules/sqlide_power_import_wizard.py", line 186, in page_activated
    self.call_create_preview_table()
  File "/usr/lib/mysql-workbench/modules/sqlide_power_import_wizard.py", line 344, in call_create_preview_table
    self.create_preview_table(self.call_analyze())
  File "/usr/lib/mysql-workbench/modules/sqlide_power_import_wizard.py", line 353, in call_analyze
    if not self.active_module.analyze_file():
  File "/usr/lib/mysql-workbench/modules/sqlide_power_import_export_be.py", line 576, in analyze_file
    self._columns[j]['value'].append(col_value)
IndexError: list index out of range

How to repeat:
1) Create table with int id and varchar data fields
2) Try to import the following csv file:

id,data
1,"a"
2,""","

If you remove the last comma in the second line -

id,data
1,"a"
2,""","

then importing this results in incorrect representation in the import wizard, and after data have finished importing, the second row contains wrong data: two quotes (should be one quote)

Suggested fix:
I haven't yet digged in that sqlide_power_import_wizard.py code, so I can't point to exact fix. But it's clear that there's some glitch in how the data are parsed that can result in either inability to import data (in my case was quite a head scratcher to identify the cause) or silently imported incorrect data.
[8 Mar 2020 6:00] MySQL Verification Team
Hello Pāvils,

Thank you for the report and feedback.
Verified as described on Win10 with WB 8.0.19.

regards,
Umesh
[8 Mar 2020 6:00] MySQL Verification Team
- csv data

id,data
1,"a"
2,""""

- CLI
truncate table t98868;
LOAD DATA INFILE 'C:\\Work\\BugsHome\\bug_verification\\98868\\98868.csv' INTO TABLE t98868
  FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  LINES TERMINATED BY '\r\n'
  IGNORE 1 LINES;
  
- data stored
# id, data
1, a
2, "

- from WB import

# id, data
1, a
2, ""

-- csv data

id,data
1,"a"
2,""","

- CLI

truncate table t98868;
LOAD DATA INFILE 'C:\\Work\\BugsHome\\bug_verification\\98868\\98868.csv' INTO TABLE t98868
  FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  LINES TERMINATED BY '\r\n'
  IGNORE 1 LINES;

3	27	11:24:33	LOAD DATA INFILE 'C:\\Work\\BugsHome\\bug_verification\\98868\\98868.csv' INTO TABLE t98868
   FIELDS TERMINATED BY ',' ENCLOSED BY '"'
   LINES TERMINATED BY '\r\n'
   IGNORE 1 LINES	2 row(s) affected
 Records: 2  Deleted: 0  Skipped: 0  Warnings: 0	0.016 sec
 
 - data stored
 
 # id, data
1, a
2, ",

 
 - WB
11:26:25 [ERR][       pymforms]: Unhandled exception in Python code: 
Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\workbench\wizard_page_widget.py", line 97, in go_next
    self.main.go_next_page()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\workbench\wizard_form.py", line 76, in go_next_page
    self.pages[index].page_activated(True)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_wizard.py", line 186, in page_activated
    self.call_create_preview_table()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_wizard.py", line 344, in call_create_preview_table
    self.create_preview_table(self.call_analyze())
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_wizard.py", line 353, in call_analyze
    if not self.active_module.analyze_file():
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\sqlide_power_import_export_be.py", line 576, in analyze_file
    self._columns[j]['value'].append(col_value)
IndexError: list index out of range
11:26:25 [DB1][ mforms managed]: Showing an error to the user