The Python DB API defines a database-neutral interface to data stored in relational databases. Python DB was designed to allow conformant modules to provide a consistent interface to different database products.
import pyodbc server = 'tcp:SQLSERVER' database = 'DB' username = 'UID' password = 'PWD' conn = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password) cursor = conn.cursor() cursor.execute('exec USR_SP product_id, \'\', \'\', \'en\'') count = 0 for row in cursor: count = count + 1 if count >= 3: print('row = %r' % (row,)) print(row[0]) # column 1 if count == 10: break