SQLite DB Introspection

If you have an SQLite database file and want to check its structure (programmatically)

SELECT * FROM sqlite_master;

To do this via Python as simple as possible, run:

conn = sqlite3.connect("your/database.sqlite")
c = conn.cursor()
c.execute('SELECT * FROM sqlite_master;')
for row in self.cursor:
    print row

Resources

Comments