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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.