Reputation: 3284
import sqlite3
conn = sqlite3.connect('boo2.db')
c = conn.cursor()
x = c.execute("SELECT * FROM sqlite_master where type='table'")
for y in x:
print(x)
the output is
********************************
<sqlite3.Cursor object at 0x00272DE0>
Process finished with exit code 0
**************************************
But not any tables ... How to get the table names ?
Upvotes: 1
Views: 4532
Reputation: 46921
you need to fetch the results from the query:
import sqlite3
conn = sqlite3.connect('boo2.db')
c = conn.cursor()
x=c.execute("SELECT * FROM sqlite_master where type='table'")
for y in x.fetchall():
print(y)
Upvotes: 3