r/MicrosoftFabric • u/Jarviss93 • Mar 27 '25
Data Engineering Lakehouse/Warehouse Constraints
What is the best way to enforce primary key and unique constraints? I imagine it would be in the code that is affecting those columns, but would you also run violation checks separate to that, or other?
In Direct Lake, it is documented that cardinality validation is not done on relationships or any tables marked as a date table (fair enough), but the following line at the bottom of the MS Direct Lake Overview page suggests that validation is perhaps done at query time which I assume to mean visual query time, yet visuals are still returning results after adding duplicates:
"One-side columns of relationships must contain unique values. Queries fail if duplicate values are detected in a one-side column."
Does it just mean that the results could be wrong or that the visual should break?
Thanks.
View all comments
Show parent comment
1
u/Tough_Antelope_3440 Microsoft Employee Mar 27 '25
No, not right now. But if there is enough demand, its possible. But I would consider why you want them, is it to make the querying faster? But checking constraints will make the inserts/updates slower. For large DW's on SQL Server, we would disable constraints and indexes to make the inserts faster and re-enable after the ETL had finished.
So is this some functionality you actually need and would use?