Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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.

Super User
Super User

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

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?

Frequent Visitor

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.

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

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors