I am basically trying to create a new database and enter the database values according to the following:
def createindextables(self):
self.con.execute('create table urllist(url)')
self.con.execute('create table worldlist(word)')
self.con.execute('create table wordlocation(urlid,wordid,location)')
self.con.execute('create table link(fromid integer,toid integer)')
self.con.execute('create table linkwords(wordid,linkid)')
self.con.execute('create index wordidx on wordlist(word)')
self.con.execute('create index urlidx on urllist(url)')
self.con.execute('create index wordurlidx on wordlocation(wordid)')
self.con.execute('create index urltoidx on link(toid)')
self.con.execute('create index urlfromidx on link(fromid)')
self.dbcommit()
But while running it “sqlite3.OperationalError: no such table: main.wordlist Error” is coming up. I am not sure why its not able to detect the search database. It should at least run from the live compiler. I don’t know why its not working properly. Can anyone help?
It might by a typo: is
worldlistsupposed to bewordlist?:If so, change the second line to:
(Otherwise, the line
might be raising an error since
wordlisthad not been defined.Just as a sanity check, you might try running
This code should work. You might then try comparing what’s different about this code than yours.