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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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