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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-shex-msft
Community Support
Community Support

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

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

Hi @v-shex-msft , Thanks for your response, but it didn't worked.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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