connection_string = ( 'Driver={SQL Server};' 'Server=(~Server_Name~);' 'Database=AdventureWorksDW2022;' 'trusted_connection=yes;' ) try: connection = pyodbc.connect ...