We can use the PRAGMA database_list command.
cur = con.cursor() cur.execute("PRAGMA database_list") rows = cur.fetchall() for row in rows: print(row[0], row[1], row[2])
The third parameter (line [2]) is the name of the database file. Please note that more databases can be added to the SQLite engine.
$ ./list_dbs.py 0 main /home/user/dbs/test.db 2 movies /home/user/dbs/movies.db
The above is an example of the output of a script that contains Python code.
Jan Bodnar
source share