Skip to content
Advertisement

How to access attached database’s tables using python’s sqlite3?

I am attempting to attach a second database to an sqlite3 connection to a database. However when I attempt to retrieve the tables from the connected database sqlite crashes as there is no such table. Even though the PRAGMA database_list sqlite command displays the connected database file, implying that the attachment was successful.

Advertisement

Answer

db_2_name‘s value is a string that is the alias of the attached database.

You should use it as the qualifier to access its sqlite_master table:

The above statement will be interpreted as:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement