MetricSign
EN|NLRequest Access
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

  1. 1Run a SELECT query to find the rows violating the constraint before the write
  2. 2Filter or transform the source data to remove or fix the offending values
  3. 3Review the CHECK constraint definition: SHOW TBLPROPERTIES <table> to see all constraints
  4. 4If the constraint is too strict for legitimate data, consider relaxing it after reviewing with the data owner
  5. 5If the constraint was recently added, validate existing data before applying it to new writes

Frequently asked questions

Can I see which rows violated the constraint?

Yes — run the same filter condition as the CHECK constraint on the source dataset to find the offending rows before attempting the write.

Does Delta enforce NOT NULL differently from CHECK?

Delta enforces NOT NULL as a schema-level constraint. CHECK constraints are defined with ALTER TABLE ADD CONSTRAINT and enforce arbitrary boolean expressions.

Other sql errors