我正在尝试使用下表为下表上传 50K+ 行数据,但查询正常,0 行受影响的消息:
CREATE TABLE IF NOT EXISTS ConsumerAlpha.HS6Data (
hs6DataID INT NOT NULL AUTO_INCREMENT,
hs6Category INT NOT NULL,
countryID INT NOT NULL,
year INT NOT NULL,
dataCode VARCHAR(15) NOT NULL,
hsValue DEC(20,2) NULL,
hsWeight DEC(20,2) NULL,
hsQuantity DEC(20,2) NULL,
hsUnitID INT NOT NULL,
dateCreated DATE NOT NULL ,
lastModified DATETIME NULL DEFAULT NULL ,
dateDeleted DATETIME NULL DEFAULT NULL ,
PRIMARY KEY (hs6DataID) ,
UNIQUE INDEX hs6DataID_UNIQUE (hs6DataID),
CONSTRAINT hs6DataCategories
FOREIGN KEY (hs6Category)
REFERENCES ConsumerAlpha.HS6CategoriesR02 (hs6Category)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT hs6DataUnits
FOREIGN KEY (hsUnitID)
REFERENCES ConsumerAlpha.HSUnits (hsUnitID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT hs6DataCountries
FOREIGN KEY (countryID)
REFERENCES ConsumerAlpha.Countries (countryID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT hs6DataCode
FOREIGN KEY (dataCode)
REFERENCES ConsumerAlpha.DataSources (dataCode )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
这是我的LOAD DATA LOCAL
命令:
LOAD DATA LOCAL
INFILE '/Users/Esperto007/Dropbox/Data/DataBase/Tables/ComTrade/hsImports_1988.csv'
INTO TABLE ConsumerAlpha.HS6Data
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r'
IGNORE 1 LINES
(hs6Category, countryID, year, dataCode, hsValue, hsWeight, hsQuantity, hsUnitID, dateCreated)
SET dateCreated = NOW();
.csv 数据符合定义中的数据类型,并且没有按照后面指示的确切顺序的索引列IGNORE 1 LINES
。在我对生成表的主要是“清理代码”的python脚本进行一些更改之前,这已经在昨天起作用了。任何帮助表示赞赏。