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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
chenyue
New Member

Timeout error while execute Python scripts in Power BI desktop

I'm using Python in Power BI Desktop, the Python scripts in Power BI could connect to a remote MySQL database, query and fetch data from the database, cleand and shape the data into dataframe, then displayed in Power BI visuals. To execute the connection and query with MySQL database, I imported pymysql module in the Python scripts, and in the sql scripts which could be executed in pymysql I defined to query and fetch data within a time range of a month. 

 

I'm using the latest version of Power BI Desktop and Python 3.8.2 on a windows 10 PC.

 

At the beginning days it worked well the Python scripts returned the correct data and displayed well in Power BI. However in the recent a few days, the Power BI returns an error of timeout after calculating for a long time, it told "ADO.NET: Python execution timeout. The script execution was terminated, since it was running for more than 7200000 miliseconds."

 

It's certain there are no mistakes in the Python scripts, since I verified in 2 ways:

1. copied the Python scripts to VS code and PyCharm, the scripts could finish successfully in a few minutes in both IDEs, and the Python executables are the same as in Power BI, which is Python 3.8.2 2. in Power BI,

2. I modified the sql scripts in Python scripts to reduce the time range to a week, then it could finish well again.

 

Then I guess if there is a limitation of imported data size via Python scripts, e.g. 300,000 rows, because prior to the timeout error the data size is less than 200,000 rows, and today it reached to 370,000+. I've checked the document in Microsoft website and found Power BI will return an error if Python scripts running over 30 minutes, but no data size limitation mentioned. Based on my test, the scripts in both VS code and PyCharm could be finished within 3-5 minutes.

 

So could any experts could help me to figure out the root cause of the timeout error? Is there any limitation of imported data size via Python scripts. Thanks in advance.

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

Hi @chenyue,

Yes, it has 150k rows and 250 Mb limit on data import, you can take a look at the following document to know more about the limitations:

Create Power BI visuals by using Python#known-limitations 

AFAIK, power bi service has some security policy on executing r/python script to access external data sources, these operations have less execute timeout than desktop and some of them may be blocked on the service side.

Power BI Security#data-storage-security 

Python visualizations in Power BI Service 

If you are work with mysql data source, why you do not choose the mysql connector, it should has better compatible with power bi desktop and execute in power bi service side.

MySQL database 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @chenyue,

Yes, it has 150k rows and 250 Mb limit on data import, you can take a look at the following document to know more about the limitations:

Create Power BI visuals by using Python#known-limitations 

AFAIK, power bi service has some security policy on executing r/python script to access external data sources, these operations have less execute timeout than desktop and some of them may be blocked on the service side.

Power BI Security#data-storage-security 

Python visualizations in Power BI Service 

If you are work with mysql data source, why you do not choose the mysql connector, it should has better compatible with power bi desktop and execute in power bi service side.

MySQL database 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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