You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-29Lines changed: 26 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,11 @@
2
2
3
3
# What's This?
4
4
5
-
An asynchronous version of `TinyDB`.
5
+
An asynchronous version of `TinyDB` with extended capabilities.
6
6
7
7
Almost every method is asynchronous. And it's based on `TinyDB 4.7.0+`.
8
8
9
-
I will try to keep up with the latest version of `TinyDB`.
10
-
11
-
9
+
Unlike `TinyDB` which has a minimal core, `Async-TinyDB` is designed to have max flexibility and performance.
12
10
13
11
# Incompatible Changes
14
12
@@ -18,23 +16,23 @@ I will try to keep up with the latest version of `TinyDB`.
18
16
19
17
***`ujson`:** Using `ujson` instead of `json`. Some arguments aren't compatible with `json`[^1]
20
18
21
-
***Storage `closed` property**: Original `TinyDB` won't raise exceptions when operating on a closed file. Now the property `closed` of `Storage` classes is required to be implemented[^why-closed][^operating-on-closed].
19
+
***[Dev-Changes](#dev-changes)**: Changes that only matter to developers (Who customise `Storage`, `Query`, etc).
22
20
23
21
***[Miscellaneous](#misc)**: Differences that only matter in edge cases.
24
22
25
23
# New Features
26
24
27
-
***Event Hooks**: You can now use event hooks to hook into an operation. See [Event Hooks](#event-hooks) for more details.
25
+
***Event Hooks**: You can now use event hooks to hook into an operation. See [Event Hooks](./docs/EventHooks.md) for more details.
28
26
29
27
***Redesigned ID & Doc Class**: You can [replace](#replacing-id-&-document-class) and [customise them](#customise-id-class) more pleasingly.
30
28
31
-
***DB-level Caching**: This significantly improves the performance of all operations. However, the responsibility of converting the data to the correct type is transferred to the Storage[^2][^disable-db-level].
29
+
***DB-level Caching**: This significantly improves the performance of all operations. However, it may cause dirty reads with some types of storage [^disable-db-level].
32
30
33
-
***Built-in `Modifier`**: Use `Modifier` to easily [encrypt](#encryption), [compress](./docs/Modifier.md#Compression) and [extend types](./docs/Modifier.md#Conversion) of your database. Sure you can do much more than these. _(See [Modifier](./docs/Modifier.md))_
31
+
***Built-in `Modifier`**: Use `Modifier` to easily [compress](./docs/Modifier.md#Compression), [encrypt](#encryption) and [extend types](./docs/Modifier.md#Conversion) of your database. Sure you can do much more than these. _(See [Modifier](./docs/Modifier.md))_
34
32
35
-
***Isolation Level**: Performance or ACID? It's up to you[^isolevel].
33
+
***Isolation Level**: Performance or thread-safe or even ACID? It's up to you[^isolevel].
36
34
37
-
***Atomic Write**: **A**CID!
35
+
***Atomic Write**: Shipped with `JSONStorage`
38
36
39
37
***Batch Search By IDs**: `search` method now takes an extra `doc_ids` argument (works like an additional condition)
40
38
@@ -50,7 +48,7 @@ I will try to keep up with the latest version of `TinyDB`.
50
48
## Importing
51
49
52
50
```Python
53
-
from asynctinydb importTinyDB, where
51
+
importasynctinydb
54
52
```
55
53
56
54
## Using
@@ -72,7 +70,7 @@ That's it.
72
70
73
71
**NOTICE: Mixing classes in one table may cause errors!**
74
72
75
-
When a table exists in a file, `Async-TinyDB` won't determine classes by itself, it is your duty to make sure classes are matching.
73
+
When a table exists in a file, `Async-TinyDB` won't determine its classes by itself, it is your duty to make sure classes are matching.
2. Deepcopy documents on insertion and retrieving. (**CR**UD) (Ensures `Index` & `Query Cache` consistency)
139
130
140
131
141
132
@@ -258,6 +249,12 @@ class BaseDocument(Mapping[IDVar, Any]):
258
249
259
250
Make sure you have implemented all the methods required by `BaseDocument` class.
260
251
252
+
# Dev-Changes
253
+
254
+
* Storage `closed` property: Original `TinyDB` won't raise exceptions when operating on a closed file. Now the property `closed` of `Storage` classes is required to be implemented[^why-closed][^operating-on-closed].
255
+
* Storage data converting: The responsibility of converting the data to the correct type is transferred to the Storage[^2]
256
+
*`is_cacheable` method in `QueryInstance` is changed to `cacheable` property and will be deprecated.
257
+
261
258
# Misc
262
259
263
260
* Lazy-load: File loading & dirs creating are delayed to the first IO operation.
@@ -266,7 +263,7 @@ Make sure you have implemented all the methods required by `BaseDocument` class
266
263
*`search` accepts optional `cond`, returns all docs if no arguments are provided
267
264
*`get` and `contains` raises `ValueError` instead of `RuntimeError` when `cond` and `doc_id` are both `None`
268
265
*`LRUCache` stores `tuple`s of ids instead of `list`s of docs
269
-
*`search` and `get` treat `doc_id` and `doc_ids` as extra conditions instead of ignoring conditions when they are provided. That is to say, when `cond` and `doc_id(s)` are passed, they return docs satisfies both `cond` and `doc_id(s)`.
266
+
*`search` and `get` treat `doc_id` and `doc_ids` as extra conditions instead of ignoring conditions when IDs are provided. That is to say, when `cond` and `doc_id(s)` are passed, they return docs satisfies `cond` and is in`doc_id(s)`.
270
267
271
268
272
269
@@ -275,6 +272,6 @@ Make sure you have implemented all the methods required by `BaseDocument` class
275
272
[^UUID-version]:Currently using UUID4
276
273
[^disable-db-level]: See [DB-level caching](#db-level-caching) to learn how to disable this feature if it causes dirty reads.
277
274
[^isolevel]: See [isolevel](#isolation-level)
278
-
[^why-closed]: This is for `Middileware` classes to reliably determine whether the `Storage` is closed, so they can raise `IOError`
279
-
[^operating-on-closed]: An `IOError` should be raised when operating on a closed storage.
275
+
[^why-closed]: This is for `Middleware` classes to reliably determine whether the `Storage` is closed, so they can raise `IOError`
276
+
[^operating-on-closed]: An `IOError` should be raised when operating on closed storage.
0 commit comments