I would like to process list of tuple
values into SQL server using python. I think we can try with loop to handle along with cursor.execute
, but that is not my requirement. I would like to process list of tuples with parametrized way as part of optimization purpose.
I tried like this but it is not working.
lt = [('a','temp_a','001'),('b','temp_b','002')]
sql = '''
EXECUTE [dbo].[mystrored_proc]
@table = %(parm)s
'''
conn = pymssql.connect(
server=server,
user=user,
password=password,
database=database)
cursor = conn.cursor()
cursor.execute(query, {'parm': lt})