Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Connessione di Python 3.3 a Microsoft SQL Server 2008

Aumenterò la risposta di mata con un esempio pypyodbc.

import pypyodbc
connection_string ='Driver={SQL Server Native Client 11.0};Server=<YOURSERVER>;Database=<YOURDATABASE>;Uid=<YOURUSER>;Pwd=<YOURPASSWORD>;'
connection = pypyodbc.connect(connection_string)
SQL = 'SELECT * FROM <YOURTABLE>'

cur = connection.cursor()
cur.execute(SQL)

cur.close()
connection.close()