简体   繁体   English

我无法在mariadb上导入数据

[英]I can't import data on mariadb

I am trying to upload a csv file on mariadb using MySQLWorkbench but with no success, what is happening, I do have my table as: 我正在尝试使用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;

but when I try to import the csv file example below: 但是当我尝试导入下面的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

I am receiving the error below: 我收到以下错误:

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)

And when I try to import without drop table and create again, I am receiving the error below: 当我尝试导入而不放置表并再次创建时,我收到以下错误:

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)

Your Table Schema is just fine. 您的表架构就可以了。 You have an error in the data import statement. 数据导入语句中有错误。 In the data import statement the number of items in each row mismatch with the number of columns at the first row. 在数据导入语句中,每行中的项目数与第一行中的列数不匹配。 Set empty semi-colons ; 设置空分号; for null values and check if the number of semi-colons in each row is equal to the number of columns in the first row. 是否为空值,并检查每行中的分号数量是否等于第一行中的列数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM