从文本Tilda分隔文件导入MYSQL错误

时间:2017-07-12 22:10:08

标签: python mysql database mysql-workbench

我正在尝试导入一个非常大的文件(超过150万条目)。该文件作为文本文件来到我身边,似乎是tilda分隔(下面的小例子)。该文件没有列标题。

我在编码UT-8的笔记本中通过“另存为”将文本文件转换为.csv。

我选择“创建新表”,当我导入文件时,它会显示出显示为所需的示例列(图片如下)。

我没有列标题。

一切看起来不错,然后我收到以下错误:

导入数据文件:

Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\workbench\wizard_progress_page_widget.py", line 192, in thread_work
    self.func()
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\sqlide_power_import_wizard.py", line 125, in start_import
    retval = self.module.start(self.stop)
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\sqlide_power_import_export_be.py", line 271, in start
    ret = self.start_import()
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\modules\sqlide_power_import_export_be.py", line 408, in start_import
    if not self.prepare_new_table():
  File "C:\Program Files\MySQL\MySQL Workbench 6.3 CE\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

有没有人有解决方案?

enter image description here

示例数据:

A~C~313869~ASPHALT PRODUCERS LLC~~130446776~US~06~1721 DAN AVE~JONESBORO~031~AR~72401-8925~~8709321306~~8709321554~US~P O BOX 1492~JONESBORO~031~AR~72403~~05~L~MC~255949~~~~~CA~~A~~~~~~3~X~~~~~~X~~X~~X~~~~~~~~~~~~~~~~~X~~X~UNSPECIFIED~Y~8~9~13~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~17~0~17~G~0~1~1~14~0~14~0~15~12~C~648127~20080723~0~0~200000~~C~20080925~~~0~20100226~MCMIS_PUBLIC~109~2~~2013~19880421~20160331~~0~~20170614~LS034LF~~20160331~3~jasonmixon@asphaltproducers.com~N~~JOHN BROADAWAY~
A~C~148428~P R MASON & SON LLC~~~US~04~HWY 70 EAST~WILLISTON~031~NC~28589~~9197293521~9197385430~9196584219~US~P O  BOX 769~WILLISTON~031~NC~28589~~37~E~MC~444916~~~~~A~~A~~~~~~1~X~~~~~~~~~X~~~~~~~~~~~~~X~~~~~~~~~N~0~1~1~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~1~0~1~A~0~1~1~0~0~0~0~1~1~S~62760~19890531~~~43978~200000~C~19890622~~~~~COMPASS0000316554~109~2~~2015~19740601~20161209~~0~~20170614~LS140NC~~20161206~1~~N~~PHILLIP R MASON~CAROL MASON
A~C~811869~BERGERON WATSON~WATSON EXPRESS~~US~04~2519 LASSITER RD~FORSYTH~207~GA~31029~~7707754324~~4043714549~US~PO BOX 5857~FORSYTH~207~GA~31029~~13~I~MC~947962~~~~~A~~A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~X~AIR FREIGHT~N~1~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~1~0~1~A~0~1~1~0~~0~0~1~0~~~~~~40000~~~~~~0~20101211~MCMIS_PUBLIC~2~2~~2014~19990524~20151229~~0~~20170614~LS31AT1~~20151229~3~cynthia@tbsokc.com~N~~BERGERON WATSON~
A~C~844689~WILLIAM & SHARON KOPKA~KOPKA EXCAVATING~~US~04~1102 SAN JOSE BLVD~HOLLY HILL~127~FL~32117~~3862522865~~3862536370~US~1102 SAN JOSE BLVD~HOLLY HILL~127~FL~32117~~12~D~~~~~~~C~~~~C~~~~~~~~~~~~~X~~~~~~~~~~X~~~~~~~~~~~~~N~0~1~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~1~0~1~A~0~0~0~1~0~1~0~1~1~~~~~~6000~0~~~~~~~~41~~~1998~19991215~20010314~~0~~20170614~LS91AT1~~~3~~~~~
A~C~687577~JGM CLEANING LLC~~~US~06~1585 VZ CR 1224~GRAND SALINE~467~TX~75140~~9039623538~~9039627862~US~1585 VZ CR 1224~GRAND SALINE~467~TX~75140~~48~D~MC~942225~~~~~A~~A~~~~~~~~~~~~~~~X~~~~~~~~~~~~~~~~~~~~~~~N~3~1~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~4~0~4~C~0~10~10~0~0~0~0~10~4~~~~~~200000~~~~~~~~MCMIS_PUBLIC~2~2~~2015~19970430~20161216~~0~~20170614~LS71AA1~~20161216~1~jody.mayne@jgmcleaningllc.com~N~~JODY GLENN MAYNE~JOANIE DENISE MAYNE
A~C~820673~DANS CONSTRUCTION AND EXCAVATION INC~~~US~05~7929 CTY HWY Q~CHIPPEWA FALLS~017~WI~54729~~7157261262~8479806718~7157261262~US~7929 CTY HWY Q~CHIPPEWA FALLS~017~WI~54729~~55~F~~~~~~~C~~A~~~~~~1~~~~~~X~X~~X~~~~~~~~~~~~~~~~~~~~~X~SAND, GRAVEL~N~3~0~3~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~3~0~3~B~0~0~0~0~2~2~0~2~2~~~~~~1~~~~~~0~20160427~MCMIS_PUBLIC~106~2~~2015~19990726~20170215~~0~~20170614~LS078WI~~20170215~2~dansmaint@gmail.com~N~~DAN OLSON~
A~C~312095~SOUTHARDS & WELCH CONSTRUCTION~~~US~04~41 QUEEN STREET~MOUNTAIN CITY~241~GA~30562~~7067822119~~~US~P O BOX 450~MOUNTAIN CITY~241~GA~30562~~13~I~~~~~~~C~~A~~~~~~3~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~X~GRAVEL~N~1~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~1~0~1~A~0~0~0~1~0~1~0~1~1~~~~~~470~~~~~~0~20150716~MCMIS_PUBLIC~109~2~~2016~19880329~20170531~~0~~20170614~LS127MW~~20170531~1~welch1121@hotmail.com~N~~FARON WELCH~
A~C~570772~CORPORATE BANK TRANSIT OF KENTUCKY INC~CORPORATE TRANSIT OF AMERICA~~US~04~3157 HIGHWAY 64 SUITE 100~EADS~157~TN~38028~~9014659917~~9014655819~US~ONE EAST LIVINGSTON AVENUE~COLUMBUS~049~OH~43215~~47~L~MC~278602~~~~~A~~A~~~~~~3~X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~N~1~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~0~1~0~1~A~~1~1~~~0~0~1~0~~~~~~10000~~~~~~0~20150414~MCMIS_PUBLIC~29~2~~2015~19940802~20160125~~0~~20170614~LS64BB964~~20160125~2~mhilliard@corporatebanktransit.com~N~~MILES E HILLIARD III~

0 个答案:

没有答案