Changelog¶
Version Numbering¶
TinyDB follows the SemVer versioning guidelines. For more information, see semver.org
Note
When new methods are added to the Query API, this may
result in breaking existing code that uses the property syntax
to 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 though
they don’t change the public API in a backwards-incompatible
manner.
To prevent this from happening, one can use the dict access
syntax (Query()['some']['nested']['field']) that will
not break even when new methods are added to the Query API.
unreleased¶
Fix: Make
Table.update(doc_ids=...)andTable.remove(doc_ids=...)behave consistently withTable.get(doc_id=...)when given document IDs that don’t exist: missing IDs are now silently skipped and the returned list only contains IDs that were actually updated/removed. Previously both methods raisedKeyError, andupdatecould leave the table in a partially-updated state when a mix of existing and missing IDs was passed (see issue 591).
v4.8.2 (2024-10-12)¶
Fix: Correctly update query cache when search results have changed (see issue 560).
v4.8.1 (2024-10-07)¶
Feature: Allow persisting empty tables (see pull request 518).
Fix: Make replacing
doc_idtype work properly (see issue 545).
v4.8.0 (2023-06-12)¶
Feature: Allow retrieve multiple documents by document ID using
Table.get(doc_ids=[...])(see pull request 504).
v4.7.1 (2023-01-14)¶
Improvement: Improve typing annotations (see pull request 477).
Improvement: Fix some typos in the documentation (see pull request 479 and pull request 498).
v4.7.0 (2022-02-19)¶
Feature: Allow inserting
Documentinstances usingTable.insert_multiple(see pull request 455).Performance: Only convert document IDs of a table when returning documents. This improves performance the
Table.countandTable.getoperations and also forTable.searchwhen only returning a few documents (see pull request 460).Internal change: Run all
TabletestsJSONStoragein addition toMemoryStorage.
v4.6.1 (2022-01-18)¶
Fix: Make using callables as queries work again (see issue 454)
v4.6.0 (2022-01-17)¶
Feature: Add map() query operation to apply a transformation to a document or field when evaluating a query (see pull request 445). Note: This may break code that queries for a field named
mapusing theQueryAPIs property access syntaxFeature: Add support for typing-extensions v4
Documentation: Fix a couple of typos in the documentation (see pull request 446, pull request 449 and pull request 453)
v4.5.2 (2021-09-23)¶
Fix: Make
Table.delete()’s argument priorities consistent with other table methods. This means that if you pass bothcondas well asdoc_idstoTable.delete(), the latter will be preferred (see issue 424)
v4.5.1 (2021-07-17)¶
Fix: Correctly install
typing-extensionson Python 3.7 (see issue 413)
v4.5.0 (2021-06-25)¶
Feature: Better type hinting/IntelliSense for PyCharm, VS Code and MyPy (see issue 372). PyCharm and VS Code should work out of the box, for MyPy see MyPy Type Checking
v4.4.0 (2021-02-11)¶
v4.3.0 (2020-11-14)¶
Feature: Add operation for updating multiple documents:
update_multiple(see issue 346)Improvement: Expose type information for MyPy typechecking (PEP 561) (see pull request 352)
v4.2.0 (2020-10-03)¶
v4.1.1 (2020-05-08)¶
Fix: Don’t install dev-dependencies when installing from PyPI (see issue 315)
v4.1.0 (2020-05-07)¶
v4.0.0 (2020-05-02)¶
Breaking Changes¶
Python 2 support has been removed, see issue 284 for background
API changes:
Removed classes:
DataProxy,StorageProxyAttributes removed from
TinyDBin favor of customizingTinyDB’s behavior by subclassing it and overloading__init__(...)andtable(...):DEFAULT_TABLEDEFAULT_TABLE_KWARGSDEFAULT_STORAGE
Arguments removed from
TinyDB(...):default_table: replace withTinyDB.default_table_name = 'name'table_class: replace withTinyDB.table_class = Class
TinyDB.contains(...)’sdoc_idsparameter has been renamed todoc_idand now only takes a single document IDTinyDB.purge_tables(...)has been renamed toTinyDB.drop_tables(...)TinyDB.purge_table(...)has been renamed toTinyDB.drop_table(...)TinyDB.write_back(...)has been removedTinyDB.process_elements(...)has been removedTable.purge()has been renamed toTable.truncate()Evaluating an empty
Query()without any test operators will now result in an exception, useQuery().noop()(introduced in v4.1.0) instead
ujsonsupport has been removed, see issue 263 and issue 306 for backgroundThe deprecated Element ID API has been removed (e.g. using the
Elementclass oreidsparameter) in favor the Document API, see pull request 158 for details on the replacement
Improvements¶
TinyDB’s internal architecture has been reworked to be more simple and streamlined in order to make it easier to customize TinyDB’s behavior
With the new architecture, TinyDB performance will improve for many applications
Bugfixes¶
v3.15.1 (2019-10-26)¶
Internal change: fix missing values handling for
LRUCache
v3.15.0 (2019-10-12)¶
Feature: allow setting the parameters of TinyDB’s default table (see issue 278)
v3.14.2 (2019-09-13)¶
Internal change: support correct iteration for
LRUCacheobjects
v3.14.1 (2019-07-03)¶
Internal change: fix Query class to permit subclass creation (see pull request 270)
v3.14.0 (2019-06-18)¶
Change: support for
ujsonis now deprecated (see issue 263)
v3.13.0 (2019-03-16)¶
Feature: direct access to a TinyDB instance’s storage (see issue 258)
v3.12.2 (2018-12-12)¶
Internal change: convert documents to dicts during insertion (see pull request 256)
Internal change: use tuple literals instead of tuple class/constructor (see pull request 247)
Infra: ensure YAML tests are run (see pull request 252)
v3.12.1 (2018-11-09)¶
Fix: Don’t break when searching the same query multiple times (see pull request 249)
Internal change: allow
collections.abc.Mutableas valid document types (see pull request 245)
v3.12.0 (2018-11-06)¶
Feature: Add encoding option to
JSONStorage(see pull request 238)Internal change: allow
collections.abc.Mutableas valid document types (see pull request 245)
v3.11.1 (2018-09-13)¶
Bugfix: Make path queries (
db.search(where('key))) work again (see issue 232)Improvement: Add custom
reprrepresentations for main classes (see pull request 229)
v3.11.0 (2018-08-20)¶
Drop official support for Python 3.3. Python 3.3 has reached its official End Of Life as of September 29, 2017. It will probably continue to work, but will not be tested against (issue 217)
Feature: Allow extending TinyDB with a custom storage proxy class (see pull request 224)
Bugfix: Return list of document IDs for upsert when creating a new document (see issue 223)
v3.10.0 (2018-07-21)¶
Feature: Add support for regex flags (see pull request 216)
v3.9.0 (2018-04-24)¶
v3.8.1 (2018-03-26)¶
Bugfix: Don’t install tests as a package anymore (see pull request #195)
v3.8.0 (2018-03-01)¶
Feature: Allow disabling the query cache with
db.table(name, cache_size=0)(see pull request #187)Feature: Add
db.write_back(docs)for replacing documents (see pull request #184)
v3.7.0 (2017-11-11)¶
Feature:
one_offor checking if a value is contained in a list (see issue 164)Feature: Upsert (insert if document doesn’t exist, otherwise update; see https://forum.m-siemens.de/d/30-primary-key-well-sort-of)
Internal change: don’t read from storage twice during initialization (see https://forum.m-siemens.de/d/28-reads-the-whole-data-file-twice)
v3.6.0 (2017-10-05)¶
Allow updating all documents using
db.update(fields)(see issue #157).Rename elements to documents. Document IDs now available with
doc.doc_id, usingdoc.eidis now deprecated (see pull request #158)
v3.5.0 (2017-08-30)¶
Expose the table name via
table.name(see issue #147).Allow better subclassing of the
TinyDBclass (see pull request #150).
v3.4.1 (2017-08-23)¶
Expose TinyDB version via
import tinyb; tinydb.__version__(see issue #148).
v3.4.0 (2017-08-08)¶
Add new update operations:
add(key, value),subtract(key, value), andset(key, value)(see pull request #145).
v3.3.1 (2017-06-27)¶
Use relative imports to allow vendoring TinyDB in other packages (see pull request #142).
v3.3.0 (2017-06-05)¶
Allow iterating over a database or table yielding all documents (see pull request #139).
v3.2.3 (2017-04-22)¶
Fix bug with accidental modifications to the query cache when modifying the list of search results (see issue #132).
v3.2.2 (2017-01-16)¶
Fix the
Queryconstructor to prevent wrong usage (see issue #117).
v3.2.1 (2016-06-29)¶
Fix a bug with queries on documents that have a
pathkey (see pull request #107).Don’t write to the database file needlessly when opening the database (see pull request #104).
v3.2.0 (2016-04-25)¶
Add a way to specify the default table name via default_table (see pull request #98).
Add
db.purge_table(name)to remove a single table (see pull request #100).Along the way: celebrating 100 issues and pull requests! Thanks everyone for every single contribution!
Extend API documentation (see issue #96).
v3.1.3 (2016-02-14)¶
Fix a bug when using unhashable documents (lists, dicts) with
Query.anyorQuery.allqueries (see a forum post by karibul).
v3.1.2 (2016-01-30)¶
Fix a bug when using unhashable documents (lists, dicts) with
Query.anyorQuery.allqueries (see a forum post by karibul).
v3.1.1 (2016-01-23)¶
v3.1.0 (2015-12-31)¶
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').barorQuery().foo.bar.In case the key is not a valid Python identifier, array notation 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.
SmartCacheTablehas been moved to msiemens/tinydb-smartcache.Serialization has been moved to msiemens/tinydb-serialization.
Empty storages are now expected to return
Noneinstead of raisingValueError. (see issue #67.
v2.4.0 (2015-08-14)¶
Allow custom parameters for custom test functions (see issue #63 and pull request #64).
v2.3.2 (2015-05-20)¶
Fix a forgotten debug output in the
SerializationMiddleware(see issue #55).Fix an “ignored exception” warning when using the
CachingMiddleware(see pull request #54)Fix a problem with symlinks when checking out TinyDB on OSX Yosemite (see issue #52).
v2.3.1 (2015-04-30)¶
Hopefully fix a problem with using TinyDB as a dependency in a
setup.pyscript (see issue #51).
v2.3.0 (2015-04-08)¶
Added support for custom serialization. That way, you can teach TinyDB to store
datetimeobjects in a JSON file :) (see issue #48 and pull request #50)Fixed a performance regression when searching became slower with every search (see issue #49)
Internal code has been cleaned up
v2.2.2 (2015-02-12)¶
Fixed a data loss when using
CachingMiddlewaretogether withJSONStorage(see issue #47)
v2.2.1 (2015-01-09)¶
Fixed handling of IDs with the JSON backend that converted integers to strings (see issue #45)
v2.2.0 (2014-11-10)¶
Extended
anyandallqueries to take lists as conditions (see pull request #38)Fixed an
decode errorwhen installing TinyDB in a non-UTF-8 environment (see pull request #37)Fixed some issues with
CachingMiddlewarein combination withJSONStorage(see pull request #39)
v2.1.0 (2014-10-14)¶
v2.0.1 (2014-09-22)¶
Fixed handling of Unicode data in Python 2 (see issue #28).
v2.0.0 (2014-09-05)¶
Warning
TinyDB changed the way data is stored. You may need to migrate your databases to the new scheme. Check out the Upgrade Notes for details.
The syntax
query in dbhas been removed, usedb.containsinstead.The
ConcurrencyMiddlewarehas been removed due to a insecure implementation (see issue #18). Consider tinyrecord instead.Better support for working with Document IDs.
Added support for nested comparisons.
Added
allandanycomparisons on lists.Added optional :<http://tinydb.readthedocs.io/en/v2.0.0/usage.html#smart-query-cache>`_.
The query cache is now a fixed size LRU cache.
v1.4.0 (2014-07-22)¶
Added
insert_multiplefunction (see issue #8).
v1.3.0 (2014-07-02)¶
Fixed bug #7: IDs not unique.
Extended the API:
db.count(where(...))anddb.contains(where(...)).The syntax
query in dbis now deprecated and replaced bydb.contains.
v1.2.0 (2014-06-19)¶
Added
updatemethod (see issue #6).
v1.1.1 (2014-06-14)¶
Merged PR #5: Fix minor documentation 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 multiple
TinyDB?instances.
v1.0.1 (2014-04-26)¶
Fixed a bug in
JSONStoragethat broke the database when removing entries.
v1.0.0 (2013-07-20)¶
First official release – consider TinyDB stable now.