Spaces:
Running
Running
File size: 373 Bytes
58478b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import sqlite3
def list_tables(db_path):
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
cursor.execute("""
SELECT name
FROM sqlite_master
WHERE type='table' AND name NOT LIKE 'sqlite_%'
""")
tables = cursor.fetchall()
connection.close()
return [x[0] for x in tables] |