return column names from pyodbc execute() statement
In case you are experiencing the NoneType
error from the code provided by Matti John, make sure to make the cursor.description
call after you have retrieved data from the database. An example:
cursor = cnxn.cursor()cursor.execute("SELECT * FROM my_table")columns = [column[0] for column in cursor.description]
This fixed it for me.