Summary
This error appears when PutDatabaseRecord is configured to perform an upsert, but Clockspring cannot identify which rows to update. Either the table does not exist, does not have a primary key, or you did not configure Update Keys.
Symptom
In the bulletin you see something like:
Failed to put Records to database... SQLIntegrityConstraintViolationException: Table '<table_name>' not found or does not have a Primary Key and no Update Keys were specified
The FlowFile is routed to the failure relationship.
Root Cause
One of the following is true:
The table name is wrong
The table does not exist in the target database
Schema prefix is missing or incorrect (for example
public.se_datavsse_data)
The table exists but there is no primary key
The table has no primary key or unique constraint
The database cannot identify which row should be updated
You are trying to upsert without telling Clockspring which columns to use
PutDatabaseRecordis set to use an upsert patternUpdate Keysproperty is emptyThe processor has no way to match incoming records to existing rows
How to Fix It
Confirm the table exists
Connect to the database
Verify the table name and schema
Update the table property in
PutDatabaseRecordif needed
Ensure the table has a primary key or unique key
Add a primary key or unique index to the table if it is meant to support upserts
Typical choice is an
idcolumn or a natural business key
Configure Update Keys in PutDatabaseRecord
Open the processor
Set the Update Keys property to a comma separated list of key columns used to identify existing rows
Example:
idExample:
customer_id, order_id
Make sure these columns exist both in the table and in the incoming records
If you only want inserts
Change the processor configuration so it performs inserts only, not upserts
Remove or clear
Update Keysand adjust any related settings accordingly
Prevention
Always design database tables that will be used for upserts with a clear primary key or unique constraint
Document which column or set of columns is the “business key” and configure those in Update Keys
Test new upsert flows with a small dataset and verify that updates behave as expected before scaling up
Related Articles
Troubleshooting SQL and Database Writes
Common PutDatabaseRecord Configuration Patterns
Designing Idempotent Database Writes
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article