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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
darshaningale
Resolver II
Resolver II

Python with Direct query in PowerBI desktop

I am using Python code to fetch data from SQL server with help of DirectQuery.

I want to pass one parameter to the select query and also want to execute python code to generate another set of columns.

It seems Pythonscript doesnt work with Direct Query.

Please guide.

5 REPLIES 5
amitchandak
Super User
Super User

@darshaningale , As far as I know, the python script method to load data is import mode

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

So, the idea of direct query is to unnable any kind of transformation in PowerBI? I mean, python doesn't work, power query doesn't work, DAX is extremly restricted. Care to explain?

Anonymous
Not applicable

No reply because no one knows. DirectQuery is useless in that mentioned cases. 

 

I believe Direct Query is meant for data that has already been transformed in your data source completely.

Anonymous
Not applicable

Agreed, came to the same conclusion and went to transform in the source

So is it that we cannot write python script for direct query ? Power BI Desktop allows to do it but shows error while executing it.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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