tinydb 4.8.2
pip install tinydb
Released:
TinyDB is a tiny, document oriented database optimized for your happiness :)
Navigation
Unverified details
These details havenot been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author:Markus Siemens
- Tags database, nosql
- Requires: Python <4.0, >=3.8
Classifiers
- Development Status
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
- Typing
Project description
Quick Links
Introduction
TinyDB is a lightweight document oriented database optimized for your happiness :)It’s written in pure Python and has no external dependencies. The target aresmall apps that would be blown away by a SQL-DB or an external database server.
TinyDB is:
tiny: The current source code has 1800 lines of code (with about 40%documentation) and 1600 lines tests.
document oriented: LikeMongoDB, you can store any document(represented asdict) in TinyDB.
optimized for your happiness: TinyDB is designed to be simple andfun to use by providing a simple and clean API.
written in pure Python: TinyDB neither needs an external server (ase.g.PyMongo) nor any dependenciesfrom PyPI.
works on Python 3.8+ and PyPy3: TinyDB works on all modern versions of Pythonand PyPy.
powerfully extensible: You can easily extend TinyDB by writing newstorages or modify the behaviour of storages with Middlewares.
100% test coverage: No explanation needed.
To dive straight into all the details, head over to theTinyDB docs. You can also discuss everything relatedto TinyDB like general development, extensions or showcase your TinyDB-basedprojects on thediscussion forum.
Supported Python Versions
TinyDB has been tested with Python 3.8 - 3.13 and PyPy3.
Project Status
This project is in maintenance mode. It has reached a mature, stable statewhere significant new features or architectural changes are not planned. Thatsaid, there will still be releases for bugfixes or features contributed bythe community. Read more about what this means in particularhere.
Example Code
>>>fromtinydbimportTinyDB,Query>>>db=TinyDB('/path/to/db.json')>>>db.insert({'int':1,'char':'a'})>>>db.insert({'int':1,'char':'b'})Query Language
>>>User=Query()>>># Search for a field value>>>db.search(User.name=='John')[{'name':'John','age':22},{'name':'John','age':37}]>>># Combine two queries with logical and>>>db.search((User.name=='John')&(User.age<=30))[{'name':'John','age':22}]>>># Combine two queries with logical or>>>db.search((User.name=='John')|(User.name=='Bob'))[{'name':'John','age':22},{'name':'John','age':37},{'name':'Bob','age':42}]>>># Negate a query with logical not>>>db.search(~(User.name=='John'))[{'name':'Megan','age':27},{'name':'Bob','age':42}]>>># Apply transformation to field with `map`>>>db.search((User.age.map(lambdax:x+x)==44))>>>[{'name':'John','age':22}]>>># More possible comparisons: != < > <= >=>>># More possible checks: where(...).matches(regex), where(...).test(your_test_func)Tables
>>>table=db.table('name')>>>table.insert({'value':True})>>>table.all()[{'value':True}]Using Middlewares
>>>fromtinydb.storagesimportJSONStorage>>>fromtinydb.middlewaresimportCachingMiddleware>>>db=TinyDB('/path/to/db.json',storage=CachingMiddleware(JSONStorage))Contributing
Whether reporting bugs, discussing improvements and new ideas or writingextensions: Contributions to TinyDB are welcome! Here’s how to get started:
Check for open issues or open a fresh issue to start a discussion arounda feature idea or a bug
Forkthe repository on Github,create a new branch off themaster branch and start making your changes(known asGitHub Flow)
Write a test which shows that the bug was fixed or that the feature worksas expected
Send a pull request and bug the maintainer until it gets merged andpublished ☺
Project details
Unverified details
These details havenot been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author:Markus Siemens
- Tags database, nosql
- Requires: Python <4.0, >=3.8
Classifiers
- Development Status
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
- Typing
Release historyRelease notifications |RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more aboutinstalling packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more aboutwheel file names.
Copy a direct link to the current filters
File details
Details for the filetinydb-4.8.2.tar.gz.
File metadata
- Download URL:tinydb-4.8.2.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.8.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f7dfc39b8d7fda7a1ca62a8dbb449ffd340a117c1206b68c50b1a481fb95181d | |
| MD5 | 67ac23c074878672271ce83129f2b0d9 | |
| BLAKE2b-256 | a0794af51e2bb214b6ea58f857c51183d92beba85b23f7ba61c983ab3de56c33 |
File details
Details for the filetinydb-4.8.2-py3-none-any.whl.
File metadata
- Download URL:tinydb-4.8.2-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.8.0-1015-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f97030ee5cbc91eeadd1d7af07ab0e48ceb04aa63d4a983adbaca4cba16e86c3 | |
| MD5 | 7e95aeb9059382885b1a5695d7f5a5ac | |
| BLAKE2b-256 | 7817853354204e1ca022d6b7d011ca7f3206c4f8faa3cc743e92609b49c1d83f |