Replies: 1 comment 1 reply
-
Hey @jmjuju, thanks for bringing this up. The documentation doesn't make this very clear but the table = db.table('table_name', cache_size=30) But, it turns out that there's some weird behavior with this in TinyDB. Namely, you cannot open the default table (which is used when I'll have to think a little about how to best solve this. As a workaround you could use a different table and pass a custom cache size there, see https://tinydb.readthedocs.io/en/latest/usage.html#tables |
Beta Was this translation helpful? Give feedback.
-
Hi Guys,
I'm using tiny db which is being updated by one script and read by another. Because of this I am using
db = TinyDB('filename.json', cache_size=0)
because otherwise the reading script doesn't get the updates/changes the the writing scripts does, as per https://tinydb.readthedocs.io/en/latest/usage.html#query-cachingHowever, when it comes to writing to the db, I then get
__init__() got an unexpected keyword argument 'cache_size'
errors, because all arguments are passed to json.dump(), as per the hint in https://tinydb.readthedocs.io/en/latest/usage.html#storage-typesAny suggestions on how to avoid this conundrum? Should I instantiate two instances, one with cache set to 0 for reading, and one without the cache_size arg for writing?
Beta Was this translation helpful? Give feedback.
All reactions