I ran into a problem in one of my programs where it was not committing some changes because my script exited shortly after the updates.
Here is a example script that reliably reproduces the effect (for me):
import json
import sqlitedict
import time
class Dict(sqlitedict.SqliteDict):
def __init__(self, name):
sqlitedict.SqliteDict.__init__(
self,
f'{name}.sqlite', autocommit=True,
encode=json.dumps, decode=json.loads )
d = Dict('d')
now = int(time.time())
for i in range(100):
d[i] = now
If I follow that up with a select, I only see 18 entries (sometimes I see zero entries):
$ sqlite3 d.sqlite 'SELECT * from unnamed'
0|1553346705
1|1553346705
2|1553346705
3|1553346705
4|1553346705
5|1553346705
6|1553346705
7|1553346705
8|1553346705
9|1553346705
10|1553346705
11|1553346705
12|1553346705
13|1553346705
14|1553346705
15|1553346705
16|1553346705
17|1553346705
18|1553346705
I ran into a problem in one of my programs where it was not committing some changes because my script exited shortly after the updates.
Here is a example script that reliably reproduces the effect (for me):
If I follow that up with a select, I only see 18 entries (sometimes I see zero entries):