cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Willgart
Helper II
Helper II

is there a way to add an OPTION at the end of each SQL in directquery mode?

Hi,

 

I want to make sure that all my generated SQL queries will have the option(maxdop 4) setup at the end of the generated queries.

is it possible to do this?

is there any hidden stuff which can be changed to add this option?

 

the reason: the server I'm accessing is setup in maxdop = 1 but for the powerbi report I want to use the 4 CPUs available.

 

thanks

 

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support

Hi @Willgart,

 

Based on my test, "option(maxdop 4) " is not supported in DirectQuery mode, but it's available in Import mode. If we specify the "option(maxdop 4) " in the query when we connect to SQL Server database use DirectQuery mode, backend generated query will like below, which is not supported in T-SQL. So the error will throws out.

 

a1.PNGa2.PNG

 

a3.PNG

 

I will report this issue internally, and update here once I get any feedback.

 

Best Regards,
Qiuyun Yu

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

yes, its "normal" to not be able to support this in the query itself today.

the directquery mode get the query you type and encapsulate it into another select statement and use it as a subquery.

and the option keyword is not supported in sub queries.

we have the same issue if we type a query which uses some CTE , they cant be encapsulated into a sub query.

 

if MS can integrate a better query parser which identifies the CTE and OPTION keywords to move them at the right place in the final query, it will be great!!!

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors
Top Kudoed Authors