How to list tables using SQLite3 in Python

Listing tables using SQLite3 returns a list of table names available in an SQLite3 database.

Solution for How to list tables using SQLite3 in Python : You can use sqlite3.Cursor.execute() to list tables using SQLite3 Call sqlite3.connect(filename) with the filename of the database as filename to open a session and return a sqlite3.Connection object. Call sqlite3.Connection.cursor() to get a sqlite3.Cursor. Call sqlite3.Cursor.execute(statement) with statement as the SQL statement SELECT name FROM sqlite_master WHERE type=’table’ to return all table names. Call sqlite3.Cursor.fetchall() to return a list of all rows in the query.


how-to-list-tables-using-sqlite3-in-python