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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
UlisesCiccola
Helper I
Helper I

Retrieve SQL from applied steps?

Hello everyone!

 

I have a question regarding power query. I have a query that has lots of transformations and would like to know if it is possible to retrieve the SQL code of these transformations to use later in MySQL or Oracle Database. Is this possible?

Just to get the select statement with all the transformations code and joins if applicable.

 

Thank you so much!!

1 ACCEPTED SOLUTION

Hi @UlisesCiccola ,

 

Some notes from official document:

 

The View Native Query option is only available for certain relational DB/SQL generating connectors. It doesn't work for OData based connectors, for example, even though there is folding occurring on the backend. The Query Diagnostics feature is the best way to see what folding has occurred for non-SQL connectors (although the steps that fold aren't explicitly called out—you just see the resulting URL that was generated).

 

If the View Native Query option is not enabled (greyed out), this is evidence that all query steps cannot be folded. However, it could mean that a subset of steps can still be folded. Working backwards from the last step, you can check each step to see if the View Native Query option is enabled. If this is the case, then you have learned where, in the sequence of steps, that query folding could no longer be achieved.

 

 

Reference: Query folding # Determine when a query can be folded | Microsoft Docs

 

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

4 REPLIES 4
Jimmy801
Community Champion
Community Champion

Hello @UlisesCiccola 

 

you can right click on your steps (till the step where query folding is taking place) and choose "view native query"

Jimmy801_0-1609509285861.png

there are also software out that can trace the statement sent from power query to sql however.

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

 

In my case the option of native query is grayed out? Which software (if possible free) can I use to retrieve this? 

 

Thank you so much @Jimmy801 !

Hi @UlisesCiccola ,

 

Some notes from official document:

 

The View Native Query option is only available for certain relational DB/SQL generating connectors. It doesn't work for OData based connectors, for example, even though there is folding occurring on the backend. The Query Diagnostics feature is the best way to see what folding has occurred for non-SQL connectors (although the steps that fold aren't explicitly called out—you just see the resulting URL that was generated).

 

If the View Native Query option is not enabled (greyed out), this is evidence that all query steps cannot be folded. However, it could mean that a subset of steps can still be folded. Working backwards from the last step, you can check each step to see if the View Native Query option is enabled. If this is the case, then you have learned where, in the sequence of steps, that query folding could no longer be achieved.

 

 

Reference: Query folding # Determine when a query can be folded | Microsoft Docs

 

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Hello @UlisesCiccola 

 

did you check all your steps? If none showing the option then propably no query folding is taking place at all. Could you share your m-code? Maybe you have a step at the beginning that breaks query folding

 

BR

 

Jimmy

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.