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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
DineshGedda
New Member

Python Scripts Error

Hi Everyone,

 

I was trying to connect to one of SQL server, where i couldn't reach out it through power Bi desktop. In my local IDE i could retrive data from same SQL source. In other way i retrived the data from power bi and up on again i tried python script but it seems again same error. Can some one hel me out why it's happening.

 

Script:

import pyodbc
conn = pyodbc.connect('Driver={SQL Server};'
'Server=server_name;'
'Database=db_name;'
'Trusted_Connection=yes;')

cursor = conn.cursor()
cursor.execute('SELECT * FROM db_name.Table')

 

 

Error:

 

2 REPLIES 2
Anonymous
Not applicable

Hi @DineshGedda ,

The file or directory is corrupted and unreadable I'm not so sure why you not use sql connector to get data, it also allow you to use t-sql query as additional parameter to sql database.

For your issue, I'd like to suggest you to check firewall settings and network policy to confirm if your request has been blocked.

Regards,

Xiaoxin Sheng

Hi @Anonymous , Thanks for your response, but it didn't worked.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.