📜  pyodbc 游标创建字典列表 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:04.664000             🧑  作者: Mango

代码示例1
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 ) ) )