code: def query_columns(conn, query, name=None):
      
  
      with conn.cursor(name) as cursor:
          cursor.itersize = 1
          cursor.execute(query)
          cursor.fetchmany(0)
          column_names = [column.name for column in cursor.description]
  
      return column_names
docs: Lightweight query to retrieve column list of select query.
  
      Notes
      -----
      Strongly urged to specify a cursor name for performance.