Using the sqlite3 module in Python, is there a way to return the output of "PRAGMA table_info()"
in a Pandas dataframe? I am not sure how to implement it in any of the Pandas read_sql functions.
For example,
conn = sqlite3.connect(db)
info = conn.execute("PRAGMA table_info('mytable')").fetchall()
conn.close()
print info
Returns [(0, u'id', u'INTEGER', 0, None, 1), (1, u'name', u'TEXT', 1, None, 0), (2, u'date', None, 0, current da...
Using the SQLite command line, PRAGMA table_info(mytable);
returns the following, which is much easier to read:
cid name type notnull dflt_value pk
---------- ---------- ---------- ---------- ---------- ----------
0 id integer 0 1
1 name text 1 0
2 date 0 current_da 0