Hi, everyone! Did anyone ever come across this problem? I'm trying to insert data into my dw.
I already disabled my FKs on my data warehouse. But it won't go anyways.
Here's the error:
Cannot add or update a child row: a foreign key constraint fails
(`dw_bi_web`.`fact_lancamento_contabil`, CONSTRAINT `fk_fact_lancamento_contabil_dim_conta_contabil1`
FOREIGN KEY (`dim_conta_contabil_sk_conta_contabil`)
REFERENCES `dim_conta_contabil` (`sk_c) [statistics] disconnected Job carga_fato_contas ended at 11:11 12/04/2018. [exit code=0]
Could you please clarify in which Talend version/edition you are?
@isadoralmeida06,this is DB related issue.
Foreign key relationships involve a parent table that holds the central data values, and a child table with identical values pointing back to its parent. The FOREIGN KEY clause is specified in the child table.
It will reject any INSERT or UPDATE operation that attempts to create a foreign key value in a child table if there is no a matching candidate key value in the parent table.
Please check the the vaule which you were instering or updating in `dw_bi_web`.`fact_lancamento_contabil` are presnt in `dim_conta_contabil`.
@isadoralmeida06, did this help you?
If so, thank's to mark your case as solved (Kudos also accepted).
Basically, yes it does have an fk in my child table, but the problem is, it should be working.
So I have a field on my parent table (item) from my data warehouse called "item_description" which is a long string, e.g : "1-The car was cleaned on time.".
And then on my database (origem), I have a table that have this same column with exact same rows "1-The car was cleaned on time." and then when I do mapping, it gives me the FK error, and when i dropped my FK constraint, it says that my sk is null, so my fact table has all NULLs on the item_sk.
Does anyone know how to make talend get it that if a text is equal to the other, get the correspondent SK?
All my other maps are working, but the matches are between, few words or number.
It works on my database. But all the project is on talend, cuz that's what my client wants. Anyways, I managed to work around it a couple of days ago,but I wish I could get it fixed by the BI rules, you know. Trought the Surrogate key. But I'll leave like this for now.
Probably the field corresponding to the foreign key is empty or null when your job push the data flow to the DB.
Can you check this point?
Else can you share your job design with settings for the DB component and maybe any tMap before this component?
No, there's no "Null" rows on my dimension, nor on my origem table. That's a "not null" column on my DBs.
@isadoralmeida06,your sure about the data then you might have configure wrongly that lookup.please check.
Lookup is fine, all others are working in the same particular job, except this one.
I honestly think it's a talend issue, I don't think it can verify if long texts columns from differents sources match.
I fixed with a workaround...thanks anyways.