I'm trying to load the Opioid data from the Washington Post, a 60 gig csv, into MySQl. the problem is the very first column header is blank (the rows in that column have numbers, just there is no header), and MySQl gives me an error in MySQL when i try to load it in with the table data import wizard.
Starting...
Prepare Import...
Prepare Import done
Import data file....
Traceback (most recent call last):
File "/usr/share/mysql-workbench/libraries/workbench/wizard_progress_page_widget.py", line 192, in thread_work
self.func()
File "/usr/lib/mysql-workbench/modules/sqlide_power_import_wizard.py", line 125, in start_import
retval = self.module.start(self.stop)
File "/usr/lib/mysql-workbench/modules/sqlide_power_import_export_be.py", line 271, in start
ret = self.start_import()
File "/usr/lib/mysql-workbench/modules/sqlide_power_import_export_be.py", line 408, in start_import
if not self.prepare_new_table():
File "/usr/lib/mysql-workbench/modules/sqlide_power_import_export_be.py", line 237, in prepare_new_table
self._editor.executeManagementCommand(""" CREATE TABLE %s (%s)""" % (self._table_w_prefix, ", ".join(["`%s` %s" % (col['name'], col["type"]) for col in self._mapping])), 1)
DBError: ("Incorrect column name ''", 1166)
ERROR: Import data file: ("Incorrect column name ''", 1166)
Failed
As you can see at the bottom, the error is the incorrect column name of '', which is the empty column header. but as I cannot load the entire 60gig csv in memory, I'm having trouble altering the column names.
What I want is to be able to edit that very first column to have some name like 'Index' or '#'. Anything so that MySQL will stop rejecting it.
I use python mainly so if anyone can give me a way of altering that column name in python I would be extremely appreciative. This is a problem I come back to every few weeks but so far haven't had any success with. Whatever help you can give me would be great.
I can't remember what I've tried. I've searched through here and given a few things a shot but I can't ever find a solution that exactly matches my problem.
What I want is simply to change the name of that first column so that when I go to load it into MySQl, I don't get that error.