data = next(reader)
query = 'insert into dbo.Test values ({0})'
query = query.format(','.join('?' * len(data)))
cursor = connection.cursor()
cursor.execute(query, data)
for data in reader:
    cursor.execute(query, data)
cursor.commit()
Writing a csv file into SQL Server database using python