Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 amafrici
		
			amafrici
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Cannot add or update a child row: a foreign key constraint fails (`db_derivato_aziende`. 'fact_investimento' ,CONSTRAINT `id_anno` FOREIGN KEY (`id_anno`) REFERENCES `dim_anno_investimento` (`id_anno`)).
I want to load my facts table but it gives me this error i dont know why, can someone help me please ?
I'm attaching pictures of my fact table fact_investimento and my dimension table dim_anno_investimento.
I'm attaching also a picture of the job that I lanched and a picture of tMap that I used.
 iamabhishek
		
			iamabhishek
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		So your error "Cannot add or update a child row: a foreign key constraint fails" essentially means that, you are trying to add a row to your `db_derivato_aziende`. 'fact_investimento' table for which no matching row (`id_anno`) is present in `dim_anno_investimento` table.
You must first insert the row to your `dim_anno_investimento` table.
 amafrici
		
			amafrici
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi, actually there are rows in my 'dim_anno_investimento` table, as you can see in the photos. So I don't know what is the problem.
 iamabhishek
		
			iamabhishek
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Yes, but what you are trying to insert that specific row(key - id_anno) is not present in the 'dim_anno_investimento` table.
Could you give an example - on what you are trying to insert here or are you able to perform the insert when you try through database ide tool and it fails only on Talend?
 amafrici
		
			amafrici
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		It fails only on Talend. Do you know an alternative solution to solve this problem?
