Do you need to bring data in from a Microsoft SQL Server database into a Python project? This is the code for a Python project I have created in Jupyter Notebook with Anaconda Navigator.
2 | from sqlalchemy import create_engine |
3 | Driver = 'ODBC Driver 17 for SQL Server' |
4 | Database_Con = f 'mssql://@{Server}/{Database}?driver={Driver}' |
6 | engine = create_engine(Database_Con) |
2 | df = pd.read_sql_query(f 'SELECT * FROM {TableName}' ,con) |

Below is the screenshot from SQL Server Management Studio.

Learn with YouTube
How to connect SQLALCHEMY to Microsoft SQL Server Database.