I'm trying to get a list of columns from a database using python.
import sqlite3, os, sys
def list(self,search):
    conn = sqlite3.connect('a.db')
    c = conn.cursor()
    c.execute("SELECT sql 
               FROM sqlite_master
                WHERE tbl_name = '" + search + "' 
                     AND type = 'table'")
    return c.fetchall()
This doesn't return the column names, but instead returns the statements I used to create the table (which does include column names, but not as intended). (i.e. CREATE TABLE table (a, b, c, d PRIMARY KEY)) Can anyone explain why this is any give a better way to do this?
I've also tried PRAGMA statements, SELECT * FROM Table WHERE False, and SELECT * FROM tables.columns WHERE tbl_name = ' search ' but the above (from How to get a list of column names on sqlite3 / iPhone?) is the closest I've come to an answer as to returning column names. I NEED THE COLUMN NAMES NOT THE DATA INSIDE THE COLUMNS. I don't wish to download or use libraries not explicitly mentioned above. Is there a means of listing the column names and not the statements used to create the tables?
 
    