Changelog

Version Numbering

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

Note

When new methods are added to theQuery API, this mayresult in breaking existing code that uses the property syntaxto access document fields (e.g.Query().some.nested.field)where the field name is equal to the newly added query method.Thus, breaking changes may occur in feature releases even thoughthey don’t change the public API in a backwards-incompatiblemanner.

To prevent this from happening, one can use the dict accesssyntax (Query()['some']['nested']['field']) that willnot break even when new methods are added to theQuery API.

unreleased

  • nothing yet

v4.8.0 (2023-06-12)

  • Feature: Allow retrieve multiple documents by document ID usingTable.get(doc_ids=[...])(seepull request 504).

v4.7.1 (2023-01-14)

v4.7.0 (2022-02-19)

  • Feature: Allow insertingDocument instances usingTable.insert_multiple(seepull request 455).
  • Performance: Only convert document IDs of a table when returning documents.This improves performance theTable.count andTable.get operationsand also forTable.search when only returning a few documents(seepull request 460).
  • Internal change: Run allTable testsJSONStorage in addition toMemoryStorage.

v4.6.1 (2022-01-18)

  • Fix: Make using callables as queries work again(seeissue 454)

v4.6.0 (2022-01-17)

v4.5.2 (2021-09-23)

  • Fix: MakeTable.delete()’s argument priorities consistent withother table methods. This means that if you pass bothcond aswell asdoc_ids toTable.delete(), the latter will be preferred(seeissue 424)

v4.5.1 (2021-07-17)

  • Fix: Correctly installtyping-extensions on Python 3.7(seeissue 413)

v4.5.0 (2021-06-25)

  • Feature: Better type hinting/IntelliSense for PyCharm, VS Code and MyPy(seeissue 372).PyCharm and VS Code should work out of the box, for MyPy seeMyPy Type Checking

v4.4.0 (2021-02-11)

  • Feature: Add operation for searching for all documents that match adictfragment (seeissue 300)
  • Fix: Correctly handle queries that use fields that are also Query methods,e.g.Query()['test'] for searching for documents with atest field(seeissue 373)

v4.3.0 (2020-11-14)

  • Feature: Add operation for updating multiple documents:update_multiple(seeissue 346)
  • Improvement: Expose type information for MyPy typechecking (PEP 561)(seepull request 352)

v4.2.0 (2020-10-03)

  • Feature: Add support for specifying document IDs during insertion(seeissue 303)
  • Internal change: UseOrderedDict.move_to_end() in the query cache(seeissue 338)

v4.1.1 (2020-05-08)

  • Fix: Don’t install dev-dependencies when installing from PyPI (seeissue 315)

v4.1.0 (2020-05-07)

  • Feature: Add a no-op queryQuery().noop() (seeissue 313)
  • Feature: Add aaccess_mode flag toJSONStorage to allow openingfiles read-only (seeissue 297)
  • Fix: Don’t drop the first document that’s being inserted when insertingdata on an existing database (seeissue 314)

v4.0.0 (2020-05-02)

Upgrade Notes

Breaking Changes

  • Python 2 support has been removed, seeissue 284for background

  • API changes:

    • Removed classes:DataProxy,StorageProxy

    • Attributes removed fromTinyDB in favor ofcustomizingTinyDB’s behavior by subclassing it and overloading__init__(...) andtable(...):

      • DEFAULT_TABLE
      • DEFAULT_TABLE_KWARGS
      • DEFAULT_STORAGE
    • Arguments removed fromTinyDB(...):

      • default_table: replace withTinyDB.default_table_name='name'
      • table_class: replace withTinyDB.table_class=Class
    • TinyDB.contains(...)’sdoc_ids parameter has been renamed todoc_id and now only takes a single document ID

    • TinyDB.purge_tables(...) has been renamed toTinyDB.drop_tables(...)

    • TinyDB.purge_table(...) has been renamed toTinyDB.drop_table(...)

    • TinyDB.write_back(...) has been removed

    • TinyDB.process_elements(...) has been removed

    • Table.purge() has been renamed toTable.truncate()

    • Evaluating an emptyQuery() without any test operators will now resultin an exception, useQuery().noop() (introduced in v4.1.0) instead

  • ujson support has been removed, seeissue 263 andissue 306 for background

  • The deprecated Element ID API has been removed (e.g. using theElementclass oreids parameter) in favor the Document API, seepull request 158 for detailson the replacement

Improvements

  • TinyDB’s internal architecture has been reworked to be more simple andstreamlined in order to make it easier to customize TinyDB’s behavior
  • With the new architecture, TinyDB performance will improve for manyapplications

Bugfixes

  • Don’t break the tests whenujson is installed (seeissue 262)
  • Fix performance when reading data (seeissue 250)
  • Fix inconsistent purge function names (seeissue 103)

v3.15.1 (2019-10-26)

  • Internal change: fix missing values handling forLRUCache

v3.15.0 (2019-10-12)

  • Feature: allow setting the parameters of TinyDB’s default table(seeissue 278)

v3.14.2 (2019-09-13)

  • Internal change: support correct iteration forLRUCache objects

v3.14.1 (2019-07-03)

  • Internal change: fix Query class to permit subclass creation(seepull request 270)

v3.14.0 (2019-06-18)

  • Change: support forujson is now deprecated(seeissue 263)

v3.13.0 (2019-03-16)

  • Feature: direct access to a TinyDB instance’s storage(seeissue 258)

v3.12.2 (2018-12-12)

v3.12.1 (2018-11-09)

  • Fix: Don’t break when searching the same query multiple times(seepull request 249)
  • Internal change: allowcollections.abc.Mutable as valid document types(seepull request 245)

v3.12.0 (2018-11-06)

v3.11.1 (2018-09-13)

  • Bugfix: Make path queries (db.search(where('key))) work again(seeissue 232)
  • Improvement: Add customrepr representations for main classes(seepull request 229)

v3.11.0 (2018-08-20)

  • Drop official support for Python 3.3. Python 3.3 has reached itsofficial End Of Life as of September 29, 2017. It will probably continueto work, but will not be tested against(issue 217)
  • Feature: Allow extending TinyDB with a custom storage proxy class(seepull request 224)
  • Bugfix: Return list of document IDs for upsert when creating a newdocument (seeissue 223)

v3.10.0 (2018-07-21)

v3.9.0 (2018-04-24)

  • Feature: Allow setting a table class for single table only(seeissue 197)
  • Internal change: call fsync after flushingJSONStorage(seeissue 208)

v3.8.1 (2018-03-26)

v3.8.0 (2018-03-01)

  • Feature: Allow disabling the query cache withdb.table(name,cache_size=0)(seepull request #187)
  • Feature: Adddb.write_back(docs) for replacing documents(seepull request #184)

v3.7.0 (2017-11-11)

v3.6.0 (2017-10-05)

  • Allow updating all documents usingdb.update(fields) (seeissue #157).
  • Rename elements to documents. Document IDs now available withdoc.doc_id,usingdoc.eid is now deprecated(seepull request #158)

v3.5.0 (2017-08-30)

v3.4.1 (2017-08-23)

  • Expose TinyDB version viaimporttinyb;tinydb.__version__ (seeissue #148).

v3.4.0 (2017-08-08)

  • Add new update operations:add(key,value),subtract(key,value),andset(key,value)(seepull request #145).

v3.3.1 (2017-06-27)

  • Use relative imports to allow vendoring TinyDB in other packages(seepull request #142).

v3.3.0 (2017-06-05)

  • Allow iterating over a database or table yielding all documents(seepull request #139).

v3.2.3 (2017-04-22)

  • Fix bug with accidental modifications to the query cache when modifyingthe list of search results (seeissue #132).

v3.2.2 (2017-01-16)

  • Fix theQuery constructor to prevent wrong usage(seeissue #117).

v3.2.1 (2016-06-29)

  • Fix a bug with queries on documents that have apath key(seepull request #107).
  • Don’t write to the database file needlessly when opening the database(seepull request #104).

v3.2.0 (2016-04-25)

  • Add a way to specify the default table name viadefault_table(seepull request #98).
  • Adddb.purge_table(name) to remove a single table(seepull request #100).
    • Along the way: celebrating 100 issues and pull requests! Thanks everyone for every single contribution!
  • Extend API documentation (seeissue #96).

v3.1.3 (2016-02-14)

  • Fix a bug when using unhashable documents (lists, dicts) withQuery.any orQuery.all queries(seea forum post by karibul).

v3.1.2 (2016-01-30)

  • Fix a bug when using unhashable documents (lists, dicts) withQuery.any orQuery.all queries(seea forum post by karibul).

v3.1.1 (2016-01-23)

  • Inserting a dictionary with data that is not JSON serializable doesn’tlead to corrupt files anymore (seeissue #89).
  • Fix a bug in the LRU cache that may lead to an invalid query cache(seeissue #87).

v3.1.0 (2015-12-31)

  • db.update(...) anddb.remove(...) now return affected document IDs(seeissue #83).
  • Inserting an invalid document (i.e. not adict) now raises an errorinstead of corrupting the database (seeissue #74).

v3.0.0 (2015-11-13)

  • Overhauled Query model:
    • where('...').contains('...') has been renamed towhere('...').search('...').
    • Support for ORM-like usage:User=Query();db.search(User.name=='John').
    • where('foo') is an alias forQuery().foo.
    • where('foo').has('bar') is replaced by eitherwhere('foo').bar orQuery().foo.bar.
      • In case the key is not a valid Python identifier, arraynotation can be used:where('a.b.c') is nowQuery()['a.b.c'].
    • Checking for the existence of a key has to be done explicitly:where('foo').exists().
  • Migrations from v1 to v2 have been removed.
  • SmartCacheTable has been moved tomsiemens/tinydb-smartcache.
  • Serialization has been moved tomsiemens/tinydb-serialization.
  • Empty storages are now expected to returnNone instead of raisingValueError.(seeissue #67.

v2.4.0 (2015-08-14)

v2.3.2 (2015-05-20)

  • Fix a forgotten debug output in theSerializationMiddleware(seeissue #55).
  • Fix an “ignored exception” warning when using theCachingMiddleware(seepull request #54)
  • Fix a problem with symlinks when checking out TinyDB on OSX Yosemite(seeissue #52).

v2.3.1 (2015-04-30)

  • Hopefully fix a problem with using TinyDB as a dependency in asetup.py script(seeissue #51).

v2.3.0 (2015-04-08)

  • Added support for custom serialization. That way, you can teach TinyDBto storedatetime objects in a JSON file :)(seeissue #48 andpull request #50)
  • Fixed a performance regression when searching became slower with every search(seeissue #49)
  • Internal code has been cleaned up

v2.2.2 (2015-02-12)

  • Fixed a data loss when usingCachingMiddleware together withJSONStorage(seeissue #47)

v2.2.1 (2015-01-09)

  • Fixed handling of IDs with the JSON backend that converted integersto strings (seeissue #45)

v2.2.0 (2014-11-10)

  • Extendedany andall queries to take lists as conditions(seepull request #38)
  • Fixed andecodeerror when installing TinyDB in a non-UTF-8 environment(seepull request #37)
  • Fixed some issues withCachingMiddleware in combination withJSONStorage (seepull request #39)

v2.1.0 (2014-10-14)

  • Addedwhere(...).contains(regex)(seeissue #32)
  • Fixed a bug that corrupted data after reopening a database(seeissue #34)

v2.0.1 (2014-09-22)

  • Fixed handling of Unicode data in Python 2(seeissue #28).

v2.0.0 (2014-09-05)

Upgrade Notes

Warning

TinyDB changed the way data is stored. You may need to migrateyour databases to the new scheme. Check out theUpgrade Notes for details.

v1.4.0 (2014-07-22)

  • Addedinsert_multiple function(seeissue #8).

v1.3.0 (2014-07-02)

  • Fixedbug #7: IDs not unique.
  • Extended the API:db.count(where(...)) anddb.contains(where(...)).
  • The syntaxqueryindb 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.

« Contribution Guidelines |Upgrading to Newer Releases »