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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
ptepichin
Helper I
Helper I

Prevent database locking using direct query in Power BI

I have a question regarding how to prevent locking a database if i'm using DirectQuery in PowerBI.

 

Steps: 

I select a server and database and click OK and don't enter sql syntax in the Advanced Options:

DirectQuery2.png

I select a table and click Load:

DirectQuery1.png

 

When I right click on the dataset and select edit query I get the following detail 

DirectQuery3.png

 

In order to prevent datalock when i entered sql i used  WITH(NOLOCK) after each table. If I select the table directly is there configuration i need to do to prevent data locks? I'm having to connect to a production database. I might possibly be able to get this data from a replicated database but i'm also concerned if i might get a dirty read if there is a conflict with pulling data during a replication.

 

 

 

  

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @ptepichin ;

You can check if these related post can is useful to you.

DirectQuery model troubleshooting in Power BI Desktop - Power BI | Microsoft Learn

Resolve blocking problem caused by lock escalation - SQL Server | Microsoft Learn


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for your response. It's very useful. In addition do you know if I need to do further configuration on power bi desktop on the datasets to prevent locking similar to using WITH(NoLock) in the sql query?

ptepichin
Helper I
Helper I

Oh, something else. Is there anything additionally I need to do to prevent locking for System-Versioned tables?

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.