Yet Another Async TinyDB
Reason this release was yanked:
Bad Specification
Project description
What's This?
"An asynchronous IO version of TinyDB
based on aiofiles
."
Almost every method is asynchronous. And it's based on TinyDB 4.7.0+
.
I will try to keep up with the latest version of TinyDB
.
Since I modified it in just a few hours, I'm not sure if it's stable enough for production.
But hey! It passed all the tests anyways.
A few extra minor differences from the original TinyDB
:
- lazy-load: When access-mode is set to
'r'
,FileNotExistsError
is not raised until the first read operation. - ujson: Using
ujson
instead ofjson
. Some arguments aren't compatible withjson
How to use IT?
Installation
pip install async-tinydb
Importing
from asynctinydb import TinyDB, where
Basically, all you need to do is insert an await
before every method that needs IO.
Notice that some parts of the code are blocking, for example when calling len()
on TinyDB
or Table
Objects.
Example Codes:
import asyncio
from asynctinydb import TinyDB, Query
async def main():
db = TinyDB('test.json')
await db.insert({"answer": 42})
print(await db.search(Query().answer == 42)) # >>> [{'answer': 42}]
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
async-tinydb-1.0.0.tar.gz
(21.5 kB
view hashes)
Built Distribution
Close
Hashes for async_tinydb-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 374716a734089cc1fea49270dbb38fc4447e5ed2ddf426e7d72ff5fc7f45b8f9 |
|
MD5 | 85dc5c49d527bee404b907ca55eb9d0d |
|
BLAKE2b-256 | e12b57014ec86339d795683381370e5e8aede9a8053527104ecd5cf10c6be723 |