I want to store a dictionary in an UnQLite database, so I can use it later on. However UnQLite stores it as a string:
>>> from unqlite import UnQLite
>>> db = UnQLite()
>>> db['dict'] = {'a': 5}
>>> db['dict']
"{'a': 5}"
I've figured out that I can use collection
which then retrieves data with their native type.
>>> from unqlite import UnQLite
>>> db = UnQLite()
>>> colors = db.collection('colors')
>>> if not colors.exists():
... colors.create()
...
>>> colors.store([{'name': 'red', 'code': '#ff0000'}, {'name': 'green', 'code': '#00ff00'}])
1
>>> colors.all()
[{'code': '#ff0000', 'name': 'red', '__id': 0}, {'code': '#00ff00', 'name': 'green', '__id': 1}]