This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi All,
I have Power BI and Python install in my local machine , and the MS SQL server in install in Remote Desktop.
I install pypyodbc and pyodbc in local machine and trying to connect my db and tables by unable to do that.
code
mport pandas as pd
import numpy as np
import os
import datetime
import pyodbc as odbc
DRIVER_NAME ='SQL SERVER'
SERVER_NAME= 'servername'
DATABASE_NAME = 'dbname'
connection_string =f"""
DRIVER={{{DRIVER_NAME}}};
SERVER={SERVER_NAME};
DATABASE={DATABASE_NAME};
Trust_Copnnection=yes;
"""
conn=odbc.connect(connection_string)
print(conn)
getting this error :
PS C:\Users\sbhadra> & C:/Users/sbhadra/AppData/Local/Programs/Python/Python312/python.exe "c:/Users/sbhadra/AppData/Local/Programs/Python Scripts/DataManipulationWhile.py"
<pyodbc.Connection object at 0x0000020C9B21FB80>
Do I need to install MS SQL Server in my local machine and also the driver ?
Solved! Go to Solution.
you don't need the server, and the ODBC driver should be installed by default. Check the 64 bit ODBC data sources control panel.
Now - why Python? Why not the standard SQL Server connector in Power Query?
you don't need the server, and the ODBC driver should be installed by default. Check the 64 bit ODBC data sources control panel.
Now - why Python? Why not the standard SQL Server connector in Power Query?
Thanks for the reply @lbendlin .
I am unable to achieve the output via power query or dax as I have two tables with M:M relationship.
I need to pull Timesheet Date from the DSR table and check the Qualification table for Date Start,Date End and Date Expiry to give output if that employee is Qualifed, Learner or Not Qualified for the hours he registered in DSR table with Timesheet data.
Will you have a look on the sample file - I have provided the details
Hi ,
I am using Python for data manipulation
You can still do that as part of the Powr Query script, AFTER you fetched the data from the SQL Server.
NOTE: As soon as you use Python or R scripts you will need to setup and maintain a Personal Gateway if you need scheduled refreshes.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.