开发者

How to get list of all the tables in sqlite programmatically

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜