Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Cannot add or update a child row: a foreign key constraint fails PutDatabaseRecord

Highlighted

Cannot add or update a child row: a foreign key constraint fails PutDatabaseRecord

New Contributor

I'm trying to Insert a CSV into a MariaDB database:
ss.png

I Infer the schema and it gives me something like this:

 

{ "type" : "record", "name" : "soccer_venue_schema", "doc" : "Schema generated by Kite", "fields" : [

{ "name" : "venue_id", "type" : "long", "doc" : "Type inferred from '20001'" },
{ "name" : "venue_name", "type" : "string", "doc" : "Type inferred from 'Stade de Bordeaux'" },
{ "name" : "city_id", "type" : "long", "doc" : "Type inferred from '10003'" },
{ "name" : "aud_capacity", "type" : [ "null", "long" ], "doc" : "Type inferred from '42115'", "default" : null }
] }

 

putdatabase.pngcsvreader.png

 

The database and the tables were previously created.

 

soccer-venue.pngsoccer_city.png

 

createtable.png

 

I'm trying to insert data into 'soccer_venue' that has a foreign key linked to 'soccer_city.city_id'. 

The table 'soccer_city' has data inside and I have tried to insert data manually via "INSERT DATA INTO soccer_venue" and it works, but when I do it in NiFi it gives this error:

 

error.png

Don't have an account?
Coming from Hortonworks? Activate your account here