Closed gooseillo closed 4 years ago
example: mydict = SqliteDict('./my_db.sqlite', autocommit=True)
mydict[1] = {'test1':'xyz', 'test2':'asd'} mydict[2] = {'test1':'xyz', 'test2':'asd'} mydict[3] = {'test1':'xyz', 'test2':'asd'}
for i, j in mydict.items(): print(i, j)
Result: 1 {'test1': 'xyz', 'test2': 'asd'} 2 {'test1': 'xyz', 'test2': 'asd'} 3 {'test1': 'xyz', 'test2': 'asd'}
Now, If I try to update the first key with another key value pair - it does not update it
mydict[1]['test3'] = 'pqr'
For storing objects that you later mutate in memory, see the Beware note in the documentation.
example: mydict = SqliteDict('./my_db.sqlite', autocommit=True)
mydict[1] = {'test1':'xyz', 'test2':'asd'} mydict[2] = {'test1':'xyz', 'test2':'asd'} mydict[3] = {'test1':'xyz', 'test2':'asd'}
for i, j in mydict.items(): print(i, j)
Result: 1 {'test1': 'xyz', 'test2': 'asd'} 2 {'test1': 'xyz', 'test2': 'asd'} 3 {'test1': 'xyz', 'test2': 'asd'}
Now, If I try to update the first key with another key value pair - it does not update it
mydict[1]['test3'] = 'pqr'
Result: 1 {'test1': 'xyz', 'test2': 'asd'} 2 {'test1': 'xyz', 'test2': 'asd'} 3 {'test1': 'xyz', 'test2': 'asd'}