我无法导入mariadb上的数据

7nbnzgx9  于 2021-06-15  发布在  Mysql
关注(0)|答案(1)|浏览(418)

我正在尝试使用mysqlworkbench在mariadb上上载csv文件,但是没有成功,发生了什么,我的表如下所示:

CREATE TABLE `emissora` (
`id_emissora` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ds_nome` varchar(100) NOT NULL,
`id_tipo_emissora` tinyint(4) DEFAULT NULL,
`ds_modulacao` varchar(5) NOT NULL,
`ds_frequencia` varchar(10) NOT NULL,
`nr_alcance` int(3) DEFAULT NULL,
`perc_alcance` decimal(5,2) DEFAULT NULL,
`qt_habitantes_alcance` int(11) DEFAULT NULL,
`ds_url` varchar(100) DEFAULT NULL,
`ds_streaming` varchar(100) DEFAULT NULL,
`ds_id_anatel` varchar(100) DEFAULT NULL,
`id_uf` int(11) DEFAULT NULL,
`ds_uf` varchar(100) DEFAULT NULL,
`id_municipio` int(10) DEFAULT NULL,
`ds_municipio` varchar(100) DEFAULT NULL,
`id_regiao` int(11) DEFAULT NULL,
`id_genero_musical` int(11) DEFAULT NULL,
PRIMARY KEY (`id_emissora`)
) ENGINE=InnoDB AUTO_INCREMENT=11129 DEFAULT CHARSET=utf8;

但是当我尝试导入下面的csv文件示例时:

id_emissora;ds_nome;id_tipo_emissora;ds_modulacao;ds_frequencia;nr_alcance;perc_alcance;qt_habitantes_alcance;ds_url;ds_streaming;ds_id_anatel;id_uf;ds_uf;id_municipio;ds_municipio;id_regiao;id_genero_musical
4;Cultura;;FM;102.5;0;;1;http://www.cultura.fm.br/;;;16;PR;2969;Cultura;5;
6;Abdallah;;FM;104.1;55;;1;http://www.abdallahfm.com.br/;http://server3.webradios.com.br:9338/9338;57dbac33ef411;16;PR;2911;Abdallah;5;Sertaneja
7;Aline;;FM;93.7;0;;1;http://www.alinefm.com.br;http://controleflash.omegasistemas.net:8356/;;;;;;;
8;Amiga;;FM;101.3;40;;1;http://www.amiga101.com.br;http://stream4.painelvox.com.br:7052;57dbac337965d;16;PR;2878;Amiga;5;Sertaneja

我收到以下错误:

DBError: ('Cannot delete or update a parent row: a foreign key constraint fails', 1451)

ERROR: Import data file: ('Cannot delete or update a parent row: a foreign key constraint fails', 1451)

当我尝试导入而不删除表并再次创建时,收到以下错误:

Prepare Import...
Prepare Import done
Import data file....
- Prepare Import
- Begin Import
- Row import failed with error: ("Incorrect integer value: '' for column 'id_genero_musical' at row 1", 1366)
- Row import failed with error: ("Incorrect integer value: 'Sertaneja' for column 'id_genero_musical' at row 1", 1366)
- Row import failed with error: ("Incorrect integer value: '' for column 'id_genero_musical' at row 1", 1366)
jm2pwxwz

jm2pwxwz1#

您的表架构很好。数据导入语句中有错误。在数据导入语句中,每行的项数与第一行的列数不匹配。设置空分号;对于空值,检查每行中分号的数目是否等于第一行中的列数。

相关问题