Answers for "pyodbc cursor create list of dictionaries"

0

pyodbc cursor create list of dictionaries

conn = pyodbc.connect( connectionString )
cursor = conn.cursor()
cursorQuery = "SELECT * FROM .."
cursor.execute( cursorQuery )
records = cursor.fetchall()
insertObject = []
columnNames = [column[0] for column in cursor.description]

for record in records:
    insertObject.append( dict( zip( columnNames , record ) ) )
Posted by: Guest on April-23-2020

Code answers related to "pyodbc cursor create list of dictionaries"

Python Answers by Framework

Browse Popular Code Answers by Language