Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
donnaolmeca
New Member

One or more rows contain values violating non-null, unique, or foreign-key constraints

I am trying to connect Power BI to my local MySQL DB.

 

I am geeting the following error:

Details: "An error happened while reading data from the provider: 'Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.'"

 

For testing purposes I created a simple table with one column only, 1-15 numerical values, no dupliactes, no-nulls - also table settings have been set to: non-null & unique, no fregin-key.

 

Not sure what is the issue here. Please advise.

4 REPLIES 4
WGordon
Frequent Visitor

I'm now having this issue as well. Did anyone find the solution?

v-yuezhe-msft
Employee
Employee

@donnaolmeca,

I have no issues when connecting to local MySQL database in Power BI Desktop. Do you get errors when you connect to MySQL database from other applications such as Excel?

Could you please post Create statement and Insert Statement of this table here so that I can test?

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

This is happening for me as well. I would like to give more color on this topic:

 

- PBI Desktop version: Nov 2018.

- MySQL 8.0.13. Default values for collation and charset.

 

I did an A/B test. I have 2 MySQL instances. For the MySQL5.7 instance, I'm able to connect to this without error.

 

The other instance MySQL 8.0.13 throws the below error when I'm attempting to connect.
"DataSource.Error: An error happened while reading data from the provider: 'Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.'"

 

This happens when trying to Get Data.

 

The table does not seem to matter. Here's a test table anyway

CREATE TABLE `tmp_test_pbi` (
`col_a` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='Testing PBI connectivity issue.';

INSERT INTO tmp_test_pbi VALUES('a'), ('b'), ('c')

I having this issue as well

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors