Skip to content

Commit d0416e9

Browse files
committed
chore: add warning about data loss/corruption with JSONStorage access_mode options
Closes: msiemens#506
1 parent 5568b13 commit d0416e9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tinydb/storages.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ def __init__(self, path: str, create_dirs=False, encoding=None, access_mode='r+'
8484
"""
8585
Create a new instance.
8686
87-
Also creates the storage file, if it doesn't exist and the access mode is appropriate for writing.
87+
Also creates the storage file, if it doesn't exist and the access mode
88+
is appropriate for writing.
89+
90+
Note: Using an access mode other than `r` or `r+` will probably lead to
91+
data loss or data corruption!
8892
8993
:param path: Where to store the JSON data.
90-
:param access_mode: mode in which the file is opened (r, r+, w, a, x, b, t, +, U)
94+
:param access_mode: mode in which the file is opened (r, r+)
9195
:type access_mode: str
9296
"""
9397

0 commit comments

Comments
 (0)