piskvorky / sqlitedict

Persistent dict, backed by sqlite3 and pickle, multithread-safe.
Apache License 2.0
1.17k stars 131 forks source link

Unable to create dictionary in database #135

Closed justin-miller1213 closed 3 years ago

justin-miller1213 commented 3 years ago

I'm trying to create a nested dictionary type structure as follows:

database = SqliteDict(DIR+"all_data.sqlite", autocommit=True)
database["material"] = dict()
database["material"][1] = 1
database["material"][1]

however, when I run the above program I get the following error:

KeyError                                  Traceback (most recent call last)
<ipython-input-162-a23cd54db1fd> in <module>
      2 database["materials"] = dict()
      3 database["materials"][1] = 1
----> 4 database["materials"][1]

KeyError: 1
justin-miller1213 commented 3 years ago

Upon re-reading the documentation, I realized this is just another case of being unable to modify a value in RAM.