Medium severitysql
Power BI Refresh Error:
CHECK_CONSTRAINT_VIOLATION
What does this error mean?
A row being inserted or updated violates a CHECK constraint defined on the Delta table. The write operation was rejected to protect data integrity.
Common causes
- 1Source data contains values outside the range defined by the constraint (e.g., a negative amount in a column constrained to be positive)
- 2A data pipeline introduced a NULL value into a column with a NOT NULL constraint expressed as a CHECK
- 3An upstream schema change produced values that no longer conform to the constraint
- 4A new constraint was added to an existing table without validating existing data
How to fix it
- 1Run a SELECT query to find the rows violating the constraint before the write
- 2Filter or transform the source data to remove or fix the offending values
- 3Review the CHECK constraint definition: SHOW TBLPROPERTIES <table> to see all constraints
- 4If the constraint is too strict for legitimate data, consider relaxing it after reviewing with the data owner
- 5If the constraint was recently added, validate existing data before applying it to new writes