Forum Discussion
AkhilGrandhi1
1 year agoHelper I
How to Connect to Power BI Service Datasets and Pull Data Using Python Locally (Outside Fabric)
I am trying to connect to a Power BI Service dataset from my local Python environment, without using Fabric Notebooks or Fabric Workspaces. My goal is to query and pull data from a published Power BI...
- 1 year ago
import adodbapi # Connection string (edit table and workspace as needed) conn = adodbapi.connect("Provider=MSOLAP.8; \ Data Source='powerbi://api.powerbi.com/v1.0/myorg/Testws'; \ Initial Catalog='db1'") # Create cursor cursor = conn.cursor() # Replace 'YourTableName' with a real table name in your data model dax_query = "EVALUATE 'table'" print("Querying table: table") cursor.execute(dax_query) # Fetch column names columns = [column[0] for column in cursor.description] print("Columns:", columns) # Fetch all rows rows = cursor.fetchall() for row in rows: print(row) # Close the connection cursor.close() conn.close()This approach is working for me
You can mark this as a solution
Thanks
AkhilGrandhi1
1 year agoHelper I
Hi v-sgandrathi
I will check and get back to you on this
v-sgandrathi
1 year agoCommunity Support
Hi AkhilGrandhi1,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Thank you.