I'm trying to create a database from an external sqlite file using this python class, but I'm getting this error message:
query() takes 2 positional arguments but 3 were given
I think I understand the issue, but I don't know a way around it, can someone point me in the right direction?
class DatabaseManager:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.conn.commit()
self.cur = self.conn.cursor()
def query(self, arg):
self.test_setup = open(arg)
self.executescript(test_setup.read())
self.cur.execute(arg)
self.con.commit()
return self.cur
def __del__(self):
self.conn.close()
dbmgr = DatabaseManager("testdb.db")
dbmgr.query('test_setup.sql', 'r')