Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
PyPI

tinydb 1.3.0

pip install tinydb==1.3.0

Newer version available (4.8.2)

Released:

TinyDB is a tiny, document oriented database optimized for your happiness :)

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for Markus.Siemens from gravatar.comMarkus.Siemens

Unverified details

These details havenot been verified by PyPI
Project links
Meta

Project description

Build StatusVersion

TinyDB is a tiny, document oriented database optimized for your happiness :)It’s written in pure Python and has no external requirements. 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 800 lines of code (+ 500 lines tests)what makes about 100 KB. For comparison:Buzhug has about 2000 lines of code(w/o tests),CodernityDB has about 8000 lines of code (w/o tests).

  • document oriented: LikeMongoDB, you can storeany document (represented asdict) in TinyDB.

  • optimized for your happiness: TinyDB is designed to be simple and fun touse. It’s not bloated and has a simple and clean API.

  • written in pure Python: TinyDB neither needs an external server (as e.g.PyMongo) nor any packages fromPyPI. Just install TinyDB and you’re ready to go.

  • easily extensible: You can easily extend TinyDB by writing new storagesor modify the behaviour of storages with Middlewares. TinyDB providesMiddlewares for caching and concurrency handling.

  • nearly 100% code coverage: If you don’t count that__repr__ methodsand some abstract methods are not tested, TinyDB has a code coverage of 100%.

Example Code

>>>fromtinydbimportTinyDB,where>>>db=TinyDB('/path/to/db.json')>>>db.insert({'int':1,'char':'a'})>>>db.insert({'int':1,'char':'b'})

Query Language

>>># Search for a field value>>>db.search(where('int')==1)[{'int':1,'char':'a'},{'int':1,'char':'b'}]>>># Combine two queries with logical and>>>db.search((where('int')==1)&(where('char')=='b'))[{'int':1,'char':'b'}]>>># Combine two queries with logical or>>>db.search((where('char')=='a')|(where('char')=='b'))[{'int':1,'char':'a'},{'int':1,'char':'b'}]>>># 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))

Documentation

The documentation for TinyDB is hosted atRead the Docs:https://tinydb.readthedocs.org/en/latest/

Supported Python Versions

TinyDB has been tested with Python 2.6, 2.7, 3.2, 3.3 and pypy.

Limitations

JSON Serialization

TinyDB serializes all data using thePython JSON module by default.It serializes most basic Python data types very well, but fails serializingclasses. If you need a better serializer, you can write your own storage,that e.g. uses the more powerfull (but also slower)pickleorPyYAML.

Performance

TinyDB is NOT designed to be used in environments, where performance might bean issue. Altough you can improve the TinyDB performance as described below,you should consider using a DB that is optimized for speed likeBuzhug orCodernityDB.

How to Improve TinyDB Performance

The default storage serializes the data using JSON. To improve performance,you can installujson , an extremelyfast JSON implementation. TinyDB will auto-detect and use it if possible.

In addition, you can wrap the storage with theCachingMiddleware whichreduces disk I/O (seeUsing Middlewares)

http://i.imgur.com/if4JI70.png

Version Numbering

TinyDB follows the SemVer versioning guidelines. For more information,seesemver.org

Changelog

v1.3.0 (2014-07-02)

  • Fixedbug #7: IDs not unique.

  • Extended the API:db.count(where(...)) anddb.contains(where(...))

  • The syntaxwhere(...) in db is nowdeprecated and replacedbydb.contains.

v1.2.0 (2014-06-19)

v1.1.1 (2014-06-14)

  • MergedPR #5: Fix minordocumentation typos and style issues.

v1.1.0 (2014-05-06)

  • Improved the docs and fixed some typos.

  • Refactored some internal code.

  • Fixed a bug with multipleTinyDB instances.

v1.0.1 (2014-04-26)

  • Fixed a bug inJSONStorage that broke the database when removing entries.

v1.0.0 (2013-07-20)

  • First official release – consider TinyDB stable now.

Project details

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for Markus.Siemens from gravatar.comMarkus.Siemens

Unverified details

These details havenot been verified by PyPI
Project links
Meta

Release historyRelease notifications |RSS feed

This version

1.3.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more aboutinstalling packages.

Source Distribution

tinydb-1.3.0.zip (20.9 kBview details)

UploadedSource

File details

Details for the filetinydb-1.3.0.zip.

File metadata

  • Download URL:tinydb-1.3.0.zip
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tinydb-1.3.0.zip
AlgorithmHash digest
SHA2565752b29a858dd0c70199def627e7ccb5b8fb7f9759eaeaca578255900d8f57cc
MD5f6ea81cc46e8a15bb9bc70a34ff0ab77
BLAKE2b-2562cea30f5d8c58de2ba237e474ae3edf36c877f30078f49926f5db068f75b11ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security SponsorDatadog MonitoringDepot Continuous IntegrationFastly CDNGoogle Download AnalyticsPingdom MonitoringSentry Error loggingStatusPage Status page

[8]ページ先頭

©2009-2025 Movatter.jp