开发者

How to get list of all the tables in sqlite programmatically

开发者 https://www.devze.com 2023-02-17 03:31 出处:网络
How can I get the list of all the available t开发者_Python百科ables in sqlite programmatically?try this :

How can I get the list of all the available t开发者_Python百科ables in sqlite programmatically?


try this :

SELECT * FROM sqlite_master where type='table';


Use the below sql statement to get list of all table in sqllite data base

SELECT * FROM dbname.sqlite_master WHERE type='table';

The same question asked before on StackOverFlow.

How to list the tables in an SQLite database file that was opened with ATTACH?


worked for me

    SELECT * FROM sqlite_master where type='table'



con = sqlite3.connect('db.sqlite')
cur = con.cursor()

cur.execute('''
    SELECT tbl_name
    FROM sqlite_master
    WHERE type = 'table';
''')

print(cur.fetchall())
0

精彩评论

暂无评论...
验证码 换一张
取 消