I am trying to access the database while the writing to the database from a different script.
The write part
def tick_entry(timestamp,ltp):
conn = sqlite3.connect('bnf_tick.db', detect_types=sqlite3.PARSE_DECLTYPES, timeout=20)
c = conn.cursor()
c.execute('INSERT INTO bnftick (timestamp, close) VALUES (?,?)',
(timestamp,ltp))
conn.commit()
c.close()
conn.close()
I am running a for loop on a pandas dataframe and writing the data using tick_entry form above.
I want to be able to access the database while the loop is running but I keep getting:
sqlite3.OperationalError: database is locked
In real-time(right now I am feeding in old data) the data should be a little more sporadic. I am trying to figure out if I will be able to access the database while it is being written to by the above function.
Am I doing something wrong?
Thanks
dbis being written into I cannot read it?