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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
zua
Frequent Visitor

Manipulate Native Query SQL

Hello, 

 

I develop a custom connector for a database which provides query folding and native query.

This database provides special functionalities in SQL queries that I want to use in the connector. 

 

Is it possible to access the SQL query of a step in the editor and manipulate it? Like when I right click on a step in the editor and see the native query?  

 

For example: I need to provide a string after a SQL statement (SELECT * FROM TEST {STRING})).

This string should be filled when a function is called, otherwise it should be empty.

The function should be callable in the power query editor. 

 

Is this somehow possible?

Thx!  

 

 

 

3 REPLIES 3
jennratten
Super User
Super User

If you are wanting to use SQL to perform the transformations instead of M (Power Query) then you can simply include that into your SQL statement in the Source step.  

zua
Frequent Visitor

Hi, 

 

thank you @Anonymous.

And is it possible to access the SQL code that is used in Power Query Steps?

These would be standard functions 

like Table.SelectRows or Table.RenameColumns? 

Anonymous
Not applicable

Hi @zua ,

To manipulate the SQL query of a step in the Power Query Editor, you would typically need to implement a custom column or a custom function that allows you to insert your additional string into the SQL statement. However, Power Query does not allow direct manipulation of the native SQL queries through the Editor's UI.
Instead, you can define your custom function in the M language that takes a SQL statement and a string as inputs and returns the modified SQL statement. For example:

let
    AppendStringToSQL = (sqlStatement as text, appendString as text) as text =>
        let
            modifiedStatement = sqlStatement & " " & appendString
        in
            modifiedStatement
in
    AppendStringToSQL

You would then call this function in your query steps where needed.

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.