I\'m trying to find out a way to find the names of tables in a database(if any exist). I find that from a sqlite cli I can use:
>.tables
<
To get the field names, use cur.description after the query:
import sqlite3.dbapi2 as sqlite
con = sqlite.connect(":memory:")
cur = con.cursor()
con.executescript("""
create table test (name, address);
insert into test (name, address) values ("Jer", "Monterey Street");
""")
cur.execute("select * from test where 1=0")
rs = cur.fetchall() ## will be [] because of where clause
field_names = [r[0] for r in cur.description]