cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Community Support
Community Support

Re: Python Scripts Error

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 Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
DineshGedda
New Member

Re: Python Scripts Error

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

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors