Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Cannot add or update a child row: a foreign key constraint fails (`matriculas`.`gestaomatriculas`, CONSTRAINT `fk_GestaoMatriculas_Calendario1` FOREIGN KEY (`ID_Calendario_Ano_Fim`) REFERENCES `calendario` (`ID_Calendario`) ON DELETE NO ACTION ON UPDATE NO A)
I want to load my facts table but it gives me this error i dont know why, can someone help me please ?
This is my facts table:
CREATE TABLE IF NOT EXISTS `matriculas`.`gestaomatriculas` (
`ID_Localizacao` int(11) NOT NULL,
`ID_Calendario_Ano_Inicio` int(11) NOT NULL,
`ID_Calendario_Ano_Fim` int(11) NOT NULL,
`ID_Escola` int(11) NOT NULL,
`ID_Entidade` int(11) NOT NULL,
`ID_Curso` int(11) NOT NULL,
`numero_homens` int(11) DEFAULT NULL,
`numero_mulheres` int(11) DEFAULT NULL,
INDEX `fk_GestaoMatriculas_Localizacao1_idx` (`ID_Localizacao` ASC),
INDEX `fk_GestaoMatriculas_Calendario1_idx` (`ID_Calendario_Ano_Fim` ASC),
INDEX `fk_GestaoMatriculas_Escola1_idx` (`ID_Escola` ASC),
INDEX `fk_GestaoMatriculas_Entidade1_idx` (`ID_Entidade` ASC),
INDEX `fk_GestaoMatriculas_Oferta1_idx` (`ID_Curso`ASC),
INDEX `fk_GestaoMatriculas_Calendario2_idx` (`ID_Calendario_Ano_Inicio`ASC),
CONSTRAINT `fk_GestaoMatriculas_Calendario1`
FOREIGN KEY (`ID_Calendario_Ano_Fim`)
REFERENCES `matriculas`.`calendario` (`ID_Calendario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_GestaoMatriculas_Calendario2`
FOREIGN KEY (`ID_Calendario_Ano_Inicio`)
REFERENCES `matriculas`.`calendario` (`ID_Calendario`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_GestaoMatriculas_Entidade1`
FOREIGN KEY (`ID_Entidade`)
REFERENCES `matriculas`.`entidade` (`ID_Entidade`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_GestaoMatriculas_Escola1`
FOREIGN KEY (`ID_Escola`)
REFERENCES `matriculas`.`escola` (`ID_Escola`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_GestaoMatriculas_Localizacao1`
FOREIGN KEY (`ID_Localizacao`)
REFERENCES `matriculas`.`localizacao` (`ID_Localizacao`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_GestaoMatriculas_Oferta1`
FOREIGN KEY (`ID_Curso`)
REFERENCES `matriculas`.`curso` (`ID_Curso`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
) ENGINE=InnoDB
This is the dimension "calendario" :
CREATE TABLE IF NOT EXISTS `Matriculas`.`calendario` (
`ID_Calendario` int(11) NOT NULL AUTO_INCREMENT,
`ano` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID_Calendario`)
) ENGINE=InnoDB
Hi,
Please verify whether you are getting right values by adding tLogrow before tMap for each input data source. You may have to trim the data to avoid any data mismatch. Please also cross verify whether you are using UTF8 since the data seems to be not in English. This could identify the possible root cause.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved
Doesnt pass the ID's i cant understand why, help me please fact table
tFileOutputDelimited
Hi,
Could you please add tLogrow and see the data? Use 5 or 10 input records for main row and restrict the records in lookup also. Then you will be able to check the details easily.
If you are adding dimension data in same job, could you please double check whether the data for dimension tables have been committed before querying them again for lookup?
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved