I tried to use this code through python to run sql-server script
import pyodbc
# 'driver = 'SQL Server'
host = '**DESKTOP-A2HRFI1\SQLSERVER**'
db1 = 'master'
tcon = 'yes'
# uname = 'jnichol3'
# pword = '**my-password**'
cnxn = pyodbc.connect(driver='{SQL Server}', host, db1, trusted_Connection=tcon)
cursor = cnxn.cursor()
cursor.execute("SELECT TOP (1000) [Student_name],[Serial_no]FROM [master].[dbo].[StudentTable]")
rows = cursor.fetchall()
for row in rows:
print row
I have this error, please help me to solve it
PS C:\Users\Admin\OneDrive\Documents\Python Projects> & C:/Users/Admin/AppData/Local/Programs/Python/Python39/python.exe
"c:/Users/Admin/OneDrive/Documents/Python Projects/Run_SQL.py" File "c:\Users\Admin\OneDrive\Documents\Python Projects\Run_SQL.py", line 10 cnxn = pyodbc.connect(driver='{SQL Server}', host, db1, trusted_Connection=tcon) ^ SyntaxError: positional argument follows keyword argument