I had a dump *.sql file of some database. I took a recipe of reading from here. Briefly, I create empty database, fill it in from the commands in the *.sql file and run some sql command to check it worked, close the database. When I reopen the databse it seems to be empty:
conn = sqlite3.connect('mine.db') #create empty database
c = conn.cursor() #coursor for the databse
fd = open('file.sql', 'r')
sqlFile = fd.read()
fd.close()
sqlCommands = sqlFile.split(';')
for command in sqlCommands:
#here read *.sql into my database..if I understood correctly
c.execute(command)
result = c.execute("SELECT * FROM phenotype;",conn)
But when I open my database again and try to execute sql command it says that there is no such table
conn = sqlite3.connect('mine.db') #create empty database
c = conn.cursor() #coursor for the databse
result = c.execute("SELECT * FROM phenotype;",conn)