Here is my code snippet:-
import sqlite3
database = "sample.db"
def dbConnection(database):
try:
connection = sqlite3.connect(database)
db_cursor = connection.cursor()
db_cursor.execute("show tables;")
rows = db_cursor.fetchall()
for row in rows:
print row
connection.close()
except sqlite3.Error, e:
print "Error in connection",e
dbConnection("enb.db")
It is raising this exception:-
Error in connection near "show": syntax error
I can't see anything wrong with the syntax as I just want to view the tables in the database. What could be the problem here?Thanks