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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Add NOLOCK syntax into Power Query

Hi,

 

We are connecting our dataset from SQL Server to Power BI and we want to include the NOLOCK syntax to avoid the lockage of DB during the scheduled data refresh time under Import mode.

Anyone can suggest how to put the syntax in place to make it work?

 

Already tried the following syntax in the Advance Editor but having error message in the below screen shot, tried many different ways to debug this but seems not working......anyone can suggest how to fix this?

 

=======================

let
 Source = Sql.Database("xxx.com", "XYZCompany"),
dbo_OrderedItemSummary = Sql.Database("xxx.com", "XYZCompany",[Query="SELECT * FROM dbo.OrdereditemSummaryPermissionGroup (NOLOCK)"]),

#"Duplicated Column" = Table.DuplicateColumn(dbo_OrderedItemSummaryPermissionGroup, "PermissionGroup", "PermissionGroup - Copy"),
#"Renamed Columns" = Table.RenameColumns(#"Duplicated Column",{{"PermissionGroup - Copy", "UserId"}}),
#"Expanded UserId" = Table.ExpandRecordColumn(#"Renamed Columns", "UserId", {"UserPermissionGroup"}, {"UserId.UserPermissionGroup"}),
#"Expanded UserId.UserPermissionGroup" = Table.ExpandTableColumn(#"Expanded UserId", "UserId.UserPermissionGroup", {"UserId"}, {"UserId.UserPermissionGroup.UserId"}),
#"Renamed Columns1" = Table.RenameColumns(#"Expanded UserId.UserPermissionGroup",{{"UserId.UserPermissionGroup.UserId", "UserId"}})
in
#"Renamed Columns1"

=======================

 

image.png

 

Here is how the table OrderedItemSummaryPermissionGroup looks like from DB.

image.png

 

Best regards,

Emily

 

4 REPLIES 4
smiglo
Frequent Visitor

Hi it seems using NOLOCK clause in direct query makes you to use a 'native query' mode that does not support query folding (needed for incremental refresh). It seems better option is to create a view from a table and add NOLOCK clause in there .

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can always create views that include (NOLOCK) and use these views in Power Query

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hi @Mariusz 

 

Can I simply include NOLOCK in the Advance Editor in Power Query instead of creating new views?

Thanks.

 

Best regards,

Emily

Hi, did you figure out the syntax for adding NOLOCK to the Advanced Editor in Power Query?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors