我正在尝试使用Python程序和sqlite3创建数据库,并且sems是一个错误。
In [2]: run readGuzikFile.py
create table measInfoHeader_0 (id0 varchar(100), id1 varchar(100), id2 varchar(100), id3 varchar(100), id4 varchar(100), id5 varchar(100), id6 varchar(100), id7 varchar(100), id8 varchar(100));
insert into measInfoHeader_0 values ("Start Time","Station","Part","Operator","Elapsed","Product","Head Stack S/N","Disk Pack S/N","Device ID");
create table measInfoData_0 (id0 varchar(100), id1 varchar(100), id2 varchar(100), id3 varchar(100), id4 varchar(100), id5 varchar(100), id6 varchar(100),
id7 varchar(100), id8 varchar(100));
insert into measInfoData_0 values ("11/5/2014 3:31:04 PM","#14","Part ID","Operator ID","00:05:28","SSM_Rembrandt SAE_E11030001","Check-In-A Wf256 SAE RE0-08#17","Ref1","77751");
create table headerTable_0_0 (id0 varchar(100), id1 varchar(100), id2 varchar(100), id3 varchar(100), id4 varchar(100), id5 varchar(100), id6 varchar(100), id7 varchar(100), id8 varchar(100), id9 varchar(100), id10 varchar(100), id11 varchar(100), id12 varchar(100), id13 varchar(100), id14 varchar(100), id15
varchar(100), id16 varchar(100), id17 varchar(100), id18 varchar(100), id19 varchar(100), id20 varchar(100), id21 varchar(100), id22 varchar(100), id23 varchar(100), id24 varchar(100), id25 varchar(100), id26 varchar(100), id27 varchar(100), id28 varchar(100), id29 varchar(100), id30 varchar(100), id31 varchar(100), id32 varchar(100), id33 varchar(100), id34 varchar(100), id35 varchar(100), id36 varchar(100), id37 varchar(100), id38 varchar(100), id39 varchar(100), id40 varchar(100), id41 varchar(100), id42 varchar(100), id43 varchar(100), id44 varchar(100), id45 varchar(100), id46 varchar(100), id47 varchar(100), id48 varchar(100), id49 varchar(100), id50 varchar(100), id51 varchar(100), id52 varchar(100), id53 varchar(100), id54 varchar(100), id55 varchar(100), id56 varchar(100), id57 varchar(100), id58 varchar(100), id59 varchar(100), id60 varchar(100), id61 varchar(100), id62 varchar(100), id63 varchar(100), id64 varchar(100), id65 varchar(100), id66 varchar(100), id67 varchar(100), id68 varchar(100), id69 varchar(100), id70 varchar(100), id71 varchar(100), id72 varchar(100), id73 varchar(100), id74 varchar(100), id75 varchar(100), id76 varchar(100), id77 varchar(100), id78 varchar(100), id79 varchar(100), id80 varchar(100), id81 varchar(100), id82 varchar(100), id83 varchar(100), id84 varchar(100), id85 varchar(100), id86 varchar(100), id87 varchar(100), id88 varchar(100), id89 varchar(100), id90 varchar(100), id91 varchar(100), id92 varchar(100), id93 varchar(100), id94 varchar(100), id95 varchar(100), id96 varchar(100), id97 varchar(100), id98 varchar(100), id99 varchar(100), id100 varchar(100), id101 varchar(100), id102 varchar(100), id103 varchar(100), id104 varchar(100), id105 varchar(100), id106 varchar(100), id107 varchar(100), id108 varchar(100), id109 varchar(100), id110 varchar(100), id111 varchar(100), id112 varchar(100), id113 varchar(100), id114 varchar(100), id115 varchar(100), id116 varchar(100), id117 varchar(100), id118 varchar(100), id119 varchar(100), id120 varchar(100), id121 varchar(100), id122 varchar(100), id123 varchar(100), id124 varchar(100), id125 varchar(100), id126 varchar(100), id127 varchar(100),
id128 varchar(100), id129 varchar(100), id130 varchar(100), id131 varchar(100), id132 varchar(100), id133 varchar(100), id134 varchar(100), id135 varchar(100), id136 varchar(100), id137 varchar(100), id138 varchar(100), id139 varchar(100), id140 varchar(100), id141 varchar(100), id142 varchar(100), id143 varchar(100), id144 varchar(100), id145 varchar(100), id146 varchar(100), id147 varchar(100), id148 varchar(100), id149 varchar(100), id150 varchar(100), id151 varchar(100), id152 varchar(100), id153 varchar(100), id154 varchar(100), id155 varchar(100), id156 varchar(100), id157 varchar(100), id158 varchar(100),
id159 varchar(100), id160 varchar(100), id161 varchar(100), id162 varchar(100), id163 varchar(100), id164 varchar(100), id165 varchar(100), id166 varchar(100), id167 varchar(100), id168 varchar(100), id169 varchar(100), id170 varchar(100), id171 varchar(100), id172 varchar(100), id173 varchar(100), id174 varchar(100), id175 varchar(100), id176 varchar(100), id177 varchar(100), id178 varchar(100), id179 varchar(100), id180 varchar(100), id181 varchar(100), id182 varchar(100), id183 varchar(100), id184 varchar(100), id185 varchar(100), id186 varchar(100), id187 varchar(100), id188 varchar(100), id189 varchar(100),
id190 varchar(100), id191 varchar(100), id192 varchar(100), id193 varchar(100), id194 varchar(100), id195 varchar(100), id196 varchar(100), id197 varchar(100));
insert into table headerTable_0_0 values ("ZName", "Zone Setup", "Track #", "Head #", "Head S/N", "Statistic Type", "Conf", "3TPeakTAA", "3T_EraseBand (nm)", "3T_MCW (nm)", "3T_OTRC (nm)", "3T_Squash", "3T_Squeeze (nm)", "3T_WROffset (nm)", "3T_WidthDelta (nm)", "3T_WidthSum (nm)", "Amp_1T", "Amp_2T", "Amp_4T", "Conf", "Frequency", "FundamentaAmpl_Sig", "HtrRead", "HtrUnit", "HtrWrite", "Neg Modulation (%)", "Noise_1T", "Noise_2T", "Noise_4T", "OvwrSA", "OvwrSAOriginalStability", "OvwrSAResidualStability", "Pos Modulation (%)", "PRBS_NE_SNR", "PRBS_NE_noise", "PRBS_NE_signal", "PRBS_Nominal_SNR", "PRBS_Nominal_noise", "PRBS_Nominal_signal", "PRBS_SE_SNR", "PRBS_SE_noise", "PRBS_SE_signal", "PRBS_WDE_SNR", "PRBS_WDE_noise", "PRBS_WDE_signal", "PSDSNR", "PSDSNR_Noise", "PSDSNR_Signal", "RMS_Total", "Read Width (nm)", "ReadWidth (nm)", "Resolution (%)", "Rmr (Ohm)", "SNR%", "SNR0", "SNR1", "SNR1T", "SNR1T_NE_SNR", "SNR1T_NE_noise", "SNR1T_NE_signal", "SNR1T_Nominal_SNR", "SNR1T_Nominal_noise", "SNR1T_Nominal_signal", "SNR1T_SE_SNR", "SNR1T_SE_noise", "SNR1T_SE_signal", "SNR1T_WDE_SNR", "SNR1T_WDE_noise", "SNR1T_WDE_signal", "SNR2T", "SNR2T_NE_SNR", "SNR2T_NE_noise", "SNR2T_NE_signal", "SNR2T_Nominal_SNR", "SNR2T_Nominal_noise", "SNR2T_Nominal_signal", "SNR2T_SE_SNR", "SNR2T_SE_noise", "SNR2T_SE_signal", "SNR2T_WDE_SNR", "SNR2T_WDE_noise", "SNR2T_WDE_signal", "SNR3T", "SNR3T_NE_SNR", "SNR3T_NE_noise", "SNR3T_NE_signal", "SNR3T_Nominal_SNR", "SNR3T_Nominal_noise", "SNR3T_Nominal_signal", "SNR3T_SE_SNR", "SNR3T_SE_noise", "SNR3T_SE_signal", "SNR3T_WDE_SNR", "SNR3T_WDE_noise", "SNR3T_WDE_signal", "SNR4T", "SNR4T_NE_SNR", "SNR4T_NE_noise", "SNR4T_NE_signal", "SNR4T_Nominal_SNR", "SNR4T_Nominal_noise", "SNR4T_Nominal_signal", "SNR4T_SE_SNR", "SNR4T_SE_noise", "SNR4T_SE_signal", "SNR4T_WDE_SNR", "SNR4T_WDE_noise", "SNR4T_WDE_signal", "SNR5T", "SNR5T_NE_SNR", "SNR5T_NE_noise", "SNR5T_NE_signal", "SNR5T_Nominal_SNR", "SNR5T_Nominal_noise", "SNR5T_Nominal_signal", "SNR5T_SE_SNR", "SNR5T_SE_noise", "SNR5T_SE_signal", "SNR5T_WDE_SNR", "SNR5T_WDE_noise", "SNR5T_WDE_signal", "SNR6T", "SNR6T_NE_SNR", "SNR6T_NE_noise", "SNR6T_NE_signal", "SNR6T_Nominal_SNR", "SNR6T_Nominal_noise", "SNR6T_Nominal_signal", "SNR6T_SE_SNR", "SNR6T_SE_noise", "SNR6T_SE_signal", "SNR6T_WDE_SNR", "SNR6T_WDE_noise", "SNR6T_WDE_signal", "Start Frequency (MHz)", "Frequency Step (MHz)", "Stop Frequency (MHz)", "SNR_Total", "T50 (ns)", "TAA (mV)", "TAA0_N", "TAA0_P", "HF TAA (mV)", "TAAHF_Neg", "TAAHF_Pos", "LF TAA (mV)", "TAALF_Neg", "TAALF_Pos", "TAARef", "TPRdWidth (nm)", "TPWROffset (nm)", "TPWrRdDelta (nm)", "TPWrRdWidth (nm)", "TPWrWidth (nm)", "TrackWidth (nm)", "UPGainStep", "WPE", "WPE_N", "WPE_P", "WROffset (nm)", "WSSNR", "Write Width (nm)", "all Power_PRBS", "besxBER_at_WROffset", "besxByte_ER", "besxCQM", "besxCUTOFF_FAST", "besxDBST_FAST", "besxIteration", "besxMRASYM_FAST", "besxMetric", "besxMinER", "besxMinER_Offset", "besxMin_ECC1_SER", "besxMin_QM", "besxMin_bitER", "besxMin_bitER_Offset", "besxMissedSyncs", "besxOTC0", "besxOTC0_er_toolow", "besxOTC0_neg", "besxOTC0_ok",
"besxOTC0_pos", "besxOTC1", "besxOTC1_er_toolow", "besxOTC1_neg", "besxOTC1_ok", "besxOTC1_pos", "besxOTC2", "besxOTC2_er_toolow", "besxOTC2_neg", "besxOTC2_ok", "besxOTC2_pos", "besxPRECOMP1T_FAST", "besxSectorsRead", "besxSymErrors", "besxWROffset", "noise Power_PRBS");
错误在最后一行,并说错误接近" table"。
---------------------------------------------------------------------------
OperationalError Traceback (most recent call last)
C:\Python27\lib\site-packages\IPython\utils\py3compat.pyc in execfile(fname, glob, loc)
195 else:
196 filename = fname
--> 197 exec compile(scripttext, filename, 'exec') in glob, loc
198 else:
199 def execfile(fname, *where):
C:\Users\S112A5584\Documents\programming\python\008. Guzik data processing\Lib\readGuzikFile.py in <module>()
179
180 # x = readFile('testAllDevices_OD.xls')
--> 181 x = readFile('temp.xls')
C:\Users\S112A5584\Documents\programming\python\008. Guzik data processing\Lib\readGuzikFile.py in readFile(fileName)
172 for s in dbStrings:
173 print s
--> 174 c.execute(s)
175 conn.commit()
176 conn.close()
OperationalError: near "table": syntax error
但是,我不认为该语法有任何问题。我之前使用过,我仔细检查了语法是否正确。不完全确定发生了什么。
任何帮助将不胜感激!