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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

'Get Data - Advanced - Enter SQL Code' - Can you input Python/R code?

Hello all:

 

I usually query SQL databases from our SQL server by typing in the SQL code right in the advanced options instead of importing the entire table into Power BI Desktop. This results in huge improvements in performance (Merges that were taking 40 minutes to run on my laptop now run in seconds on the SQL Server). 

 

I was wondering, since Python and R are part of the "Machine Learning Services" in SQL Server Management Studio, does Power BI feed any typed Python/R code back to the server for processing, or will it result in an error? 

 

Thanks a lot!

 

@VThai81 

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

After my tests, you could only input SQL statement. Python/R code will return errors.

 

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

View solution in original post

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

After my tests, you could only input SQL statement. Python/R code will return errors.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

Ok, thanks a lot!

 

Looks like we'll have to create views in SSMS. 

 

Thanks again.

 

 

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.