Changelogs >

Tinydb

PyUp actively tracks 429,349 Python packages for vulnerabilities to keep your Python environments secure.

Scan your dependencies

4.7.0

^^^^^^^^^^^^^^^^^^^

- Feature: Allow inserting ``Document`` instances using ``Table.insert_multiple``
(see `pull request 455 <https://github.com/msiemens/tinydb/pull/455>`_).
- Performance: Only convert document IDs of a table when returning documents.
This improves performance the ``Table.count`` and ``Table.get`` operations
and also for ``Table.search`` when only returning a few documents
(see `pull request 460 <https://github.com/msiemens/tinydb/pull/460>`_).
- Internal change: Run all ``Table`` tests ``JSONStorage`` in addition to
``MemoryStorage``.

4.6.1

^^^^^^^^^^^^^^^^^^^

- Fix: Make using callables as queries work again
(see `issue 454 <https://github.com/msiemens/tinydb/issues/454>`__)

4.6.0

^^^^^^^^^^^^^^^^^^^

- Feature: Add `map()` query operation to apply a transformation
to a document or field when evaluating a query
(see `pull request 445 <https://github.com/msiemens/tinydb/pull/445>`_).
**Note**: This may break code that queries for a field named ``map``
using the ``Query`` APIs property access syntax
- Feature: Add support for `typing-extensions <https://pypi.org/project/typing-extensions/>`_
v4
- Documentation: Fix a couple of typos in the documentation (see
`pull request 446 <https://github.com/msiemens/tinydb/pull/446>`_,
`pull request 449 <https://github.com/msiemens/tinydb/pull/449>`_ and
`pull request 453 <https://github.com/msiemens/tinydb/pull/453>`_)

4.5.2

^^^^^^^^^^^^^^^^^^^

- Fix: Make ``Table.delete()``'s argument priorities consistent with
other table methods. This means that if you pass both ``cond`` as
well as ``doc_ids`` to ``Table.delete()``, the latter will be prefered
(see `issue 424 <https://github.com/msiemens/tinydb/issues/424>`__)

4.5.1

^^^^^^^^^^^^^^^^^^^

- Fix: Correctly install ``typing-extensions`` on Python 3.7
(see `issue 413 <https://github.com/msiemens/tinydb/issues/413>`__)

4.5.0

^^^^^^^^^^^^^^^^^^^

- Feature: Better type hinting/IntelliSense for PyCharm, VS Code and MyPy
(see `issue 372 <https://github.com/msiemens/tinydb/issues/372>`__).
PyCharm and VS Code should work out of the box, for MyPy see
:ref:`MyPy Type Checking <mypy_type_checking>`

4.4.0

^^^^^^^^^^^^^^^^^^^

- Feature: Add operation for searching for all documents that match a ``dict``
fragment (see `issue 300 <https://github.com/msiemens/tinydb/issues/300>`_)
- Fix: Correctly handle queries that use fields that are also Query methods,
e.g. ``Query()['test']`` for searching for documents with a ``test`` field
(see `issue 373 <https://github.com/msiemens/tinydb/issues/373>`_)

4.3.0

^^^^^^^^^^^^^^^^^^^

- Feature: Add operation for updating multiple documents: ``update_multiple``
(see `issue 346 <https://github.com/msiemens/tinydb/issues/346>`_)
- Improvement: Expose type information for MyPy typechecking (PEP 561)
(see `pull request 352 <https://github.com/msiemens/tinydb/pull/352>`_)

4.2.0

^^^^^^^^^^^^^^^^^^^

- Feature: Add support for specifying document IDs during insertion
(see `issue 303 <https://github.com/msiemens/tinydb/issues/303>`_)
- Internal change: Use ``OrderedDict.move_to_end()`` in the query cache
(see `issue 338 <https://github.com/msiemens/tinydb/issues/338>`_)

4.1.1

^^^^^^^^^^^^^^^^^^^

- Fix: Don't install dev-dependencies when installing from PyPI (see
`issue 315 <https://github.com/msiemens/tinydb/issues/315>`_)

4.1.0

^^^^^^^^^^^^^^^^^^^

- Feature: Add a no-op query ``Query().noop()`` (see
`issue 313 <https://github.com/msiemens/tinydb/issues/313>`_)
- Feature: Add a ``access_mode`` flag to ``JSONStorage`` to allow opening
files read-only (see `issue 297 <https://github.com/msiemens/tinydb/issues/297>`_)
- Fix: Don't drop the first document that's being inserted when inserting
data on an existing database (see `issue 314
<https://github.com/msiemens/tinydb/issues/314>`_)

4.0.0

^^^^^^^^^^^^^^^^^^^

:ref:`Upgrade Notes <upgrade_v4_0>`

Breaking Changes
----------------

- Python 2 support has been removed, see `issue 284
<https://github.com/msiemens/tinydb/issues/284>`_
for background
- API changes:

- Removed classes: ``DataProxy``, ``StorageProxy``
- Attributes removed from ``TinyDB`` in favor of
customizing ``TinyDB``'s behavior by subclassing it and overloading
``__init__(...)`` and ``table(...)``:

- ``DEFAULT_TABLE``
- ``DEFAULT_TABLE_KWARGS``
- ``DEFAULT_STORAGE``

- Arguments removed from ``TinyDB(...)``:

- ``default_table``: replace with ``TinyDB.default_table_name = 'name'``
- ``table_class``: replace with ``TinyDB.table_class = Class``

- ``TinyDB.contains(...)``'s ``doc_ids`` parameter has been renamed to
``doc_id`` and now only takes a single document ID
- ``TinyDB.purge_tables(...)`` has been renamed to ``TinyDB.drop_tables(...)``
- ``TinyDB.purge_table(...)`` has been renamed to ``TinyDB.drop_table(...)``
- ``TinyDB.write_back(...)`` has been removed
- ``TinyDB.process_elements(...)`` has been removed
- ``Table.purge()`` has been renamed to ``Table.truncate()``
- Evaluating an empty ``Query()`` without any test operators will now result
in an exception, use ``Query().noop()`` (introduced in v4.1.0) instead

- ``ujson`` support has been removed, see `issue 263
<https://github.com/msiemens/tinydb/issues/263>`_ and `issue 306
<https://github.com/msiemens/tinydb/issues/306>`_ for background
- The deprecated Element ID API has been removed (e.g. using the ``Element``
class or ``eids`` parameter) in favor the Document API, see
`pull request 158 <https://github.com/msiemens/tinydb/pull/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
--------

- Don't break the tests when ``ujson`` is installed (see `issue 262
<https://github.com/msiemens/tinydb/issues/262>`_)
- Fix performance when reading data (see `issue 250
<https://github.com/msiemens/tinydb/issues/250>`_)
- Fix inconsistent purge function names (see `issue 103
<https://github.com/msiemens/tinydb/issues/103>`_)

3.15.1

^^^^^^^^^^^^^^^^^^^^

- Internal change: fix missing values handling for ``LRUCache``

3.15.0

^^^^^^^^^^^^^^^^^^^^

- Feature: allow setting the parameters of TinyDB's default table
(see `issue 278 <https://github.com/msiemens/tinydb/issues/278>`_)

3.14.2

^^^^^^^^^^^^^^^^^^^^

- Internal change: support correct iteration for ``LRUCache`` objects

3.14.1

^^^^^^^^^^^^^^^^^^^^

- Internal change: fix Query class to permit subclass creation
(see `pull request 270 <https://github.com/msiemens/tinydb/pull/270>`_)

3.14.0

^^^^^^^^^^^^^^^^^^^^

- Change: support for ``ujson`` is now deprecated
(see `issue 263 <https://github.com/msiemens/tinydb/issues/263>`_)

3.13.0

^^^^^^^^^^^^^^^^^^^^

- Feature: direct access to a TinyDB instance's storage
(see `issue 258 <https://github.com/msiemens/tinydb/issues/258>`_)

3.12.2

^^^^^^^^^^^^^^^^^^^^

- Internal change: convert documents to dicts during insertion
(see `pull request 256 <https://github.com/msiemens/tinydb/pull/256>`_)
- Internal change: use tuple literals instead of tuple class/constructor
(see `pull request 247 <https://github.com/msiemens/tinydb/pull/247>`_)
- Infra: ensure YAML tests are run
(see `pull request 252 <https://github.com/msiemens/tinydb/pull/252>`_)

3.12.1

^^^^^^^^^^^^^^^^^^^^

- Fix: Don't break when searching the same query multiple times
(see `pull request 249 <https://github.com/msiemens/tinydb/pull/249>`_)
- Internal change: allow ``collections.abc.Mutable`` as valid document types
(see `pull request 245 <https://github.com/msiemens/tinydb/pull/245>`_)

3.12.0

^^^^^^^^^^^^^^^^^^^^

- Feature: Add encoding option to ``JSONStorage``
(see `pull request 238 <https://github.com/msiemens/tinydb/pull/238>`_)
- Internal change: allow ``collections.abc.Mutable`` as valid document types
(see `pull request 245 <https://github.com/msiemens/tinydb/pull/245>`_)

3.11.1

^^^^^^^^^^^^^^^^^^^^

- Bugfix: Make path queries (``db.search(where('key))``) work again
(see `issue 232 <https://github.com/msiemens/tinydb/issues/232>`_)
- Improvement: Add custom ``repr`` representations for main classes
(see `pull request 229 <https://github.com/msiemens/tinydb/pull/229>`_)

3.11.0

^^^^^^^^^^^^^^^^^^^^

- **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 <https://github.com/msiemens/tinydb/issues/217>`_)

- Feature: Allow extending TinyDB with a custom storage proxy class
(see `pull request 224 <https://github.com/msiemens/tinydb/pull/224>`_)
- Bugfix: Return list of document IDs for upsert when creating a new
document (see `issue 223 <https://github.com/msiemens/tinydb/issues/223>`_)

3.10.0

^^^^^^^^^^^^^^^^^^^^

- Feature: Add support for regex flags
(see `pull request 216 <https://github.com/msiemens/tinydb/pull/216>`_)

3.9.0

^^^^^^^^^^^^^^^^^^^

- Feature: Allow setting a table class for single table only
(see `issue 197 <https://github.com/msiemens/tinydb/issues/197>`_)
- Internal change: call fsync after flushing ``JSONStorage``
(see `issue 208 <https://github.com/msiemens/tinydb/issues/208>`_)

3.8.1

^^^^^^^^^^^^^^^^^^^

- Bugfix: Don't install tests as a package anymore
(see `pull request 195 <https://github.com/msiemens/tinydb/pull/195>`_)

3.8.0

^^^^^^^^^^^^^^^^^^^

- Feature: Allow disabling the query cache with ``db.table(name, cache_size=0)``
(see `pull request 187 <https://github.com/msiemens/tinydb/pull/187>`_)
- Feature: Add ``db.write_back(docs)`` for replacing documents
(see `pull request 184 <https://github.com/msiemens/tinydb/pull/184>`_)

3.7.0

^^^^^^^^^^^^^^^^^^^

- Feature: ``one_of`` for checking if a value is contained in a list
(see `issue 164 <https://github.com/msiemens/tinydb/issues/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)

3.6.0

^^^^^^^^^^^^^^^^^^^

- Allow updating all documents using ``db.update(fields)`` (see
`issue 157 <https://github.com/msiemens/tinydb/issues/157>`_).
- Rename elements to documents. Document IDs now available with ``doc.doc_id``,
using ``doc.eid`` is now deprecated
(see `pull request 158 <https://github.com/msiemens/tinydb/pull/158>`_)

3.5.0

^^^^^^^^^^^^^^^^^^^

- Expose the table name via ``table.name`` (see
`issue 147 <https://github.com/msiemens/tinydb/issues/147>`_).
- Allow better subclassing of the ``TinyDB`` class
(see `pull request 150 <https://github.com/msiemens/tinydb/pull/150>`_).

3.4.1

^^^^^^^^^^^^^^^^^^^

- Expose TinyDB version via ``import tinyb; tinydb.__version__`` (see
`issue 148 <https://github.com/msiemens/tinydb/issues/148>`_).

3.4.0

^^^^^^^^^^^^^^^^^^^

- Add new update operations: ``add(key, value)``, ``substract(key, value)``,
and ``set(key, value)``
(see `pull request 145 <https://github.com/msiemens/tinydb/pull/145>`_).

3.3.1

^^^^^^^^^^^^^^^^^^^

- Use relative imports to allow vendoring TinyDB in other packages
(see `pull request 142 <https://github.com/msiemens/tinydb/pull/142>`_).

3.3.0

^^^^^^^^^^^^^^^^^^^

- Allow iterating over a database or table yielding all documents
(see `pull request 139 <https://github.com/msiemens/tinydb/pull/139>`_).

3.2.3

^^^^^^^^^^^^^^^^^^^

- Fix bug with accidental modifications to the query cache when modifying
the list of search results (see `issue 132 <https://github.com/msiemens/tinydb/issues/132>`_).

3.2.2

^^^^^^^^^^^^^^^^^^^

- Fix the ``Query`` constructor to prevent wrong usage
(see `issue 117 <https://github.com/msiemens/tinydb/issues/117>`_).

3.2.1

^^^^^^^^^^^^^^^^^^^

- Fix a bug with queries on documents that have a ``path`` key
(see `pull request 107 <https://github.com/msiemens/tinydb/pull/107>`_).
- Don't write to the database file needlessly when opening the database
(see `pull request 104 <https://github.com/msiemens/tinydb/pull/104>`_).

3.2.0

^^^^^^^^^^^^^^^^^^^

- Add a way to specify the default table name via :ref:`default_table <default_table>`
(see `pull request 98 <https://github.com/msiemens/tinydb/pull/98>`_).
- Add ``db.purge_table(name)`` to remove a single table
(see `pull request 100 <https://github.com/msiemens/tinydb/pull/100>`_).

- Along the way: celebrating 100 issues and pull requests! Thanks everyone for every single contribution!

- Extend API documentation (see `issue 96 <https://github.com/msiemens/tinydb/issues/96>`_).

3.1.3

^^^^^^^^^^^^^^^^^^^

- Fix a bug when using unhashable documents (lists, dicts) with
``Query.any`` or ``Query.all`` queries
(see `a forum post by karibul <https://forum.m-siemens.de/d/4-error-with-any-and-all-queries>`_).

3.1.2

^^^^^^^^^^^^^^^^^^^

- Fix a bug when using unhashable documents (lists, dicts) with
``Query.any`` or ``Query.all`` queries
(see `a forum post by karibul <https://forum.m-siemens.de/d/4-error-with-any-and-all-queries>`_).

3.1.1

^^^^^^^^^^^^^^^^^^^

- Inserting a dictionary with data that is not JSON serializable doesn't
lead to corrupt files anymore (see `issue 89 <https://github.com/msiemens/tinydb/issues/89>`_).
- Fix a bug in the LRU cache that may lead to an invalid query cache
(see `issue 87 <https://github.com/msiemens/tinydb/issues/87>`_).

3.1.0

^^^^^^^^^^^^^^^^^^^

- ``db.update(...)`` and ``db.remove(...)`` now return affected document IDs
(see `issue 83 <https://github.com/msiemens/tinydb/issues/83>`_).
- Inserting an invalid document (i.e. not a ``dict``) now raises an error
instead of corrupting the database (see
`issue 74 <https://github.com/msiemens/tinydb/issues/74>`_).

3.0.0

^^^^^^^^^^^^^^^^^^^

- Overhauled Query model:

- ``where('...').contains('...')`` has been renamed to
``where('...').search('...')``.
- Support for ORM-like usage:
``User = Query(); db.search(User.name == 'John')``.
- ``where('foo')`` is an alias for ``Query().foo``.
- ``where('foo').has('bar')`` is replaced by either
``where('foo').bar`` or ``Query().foo.bar``.

- In case the key is not a valid Python identifier, array
notation can be used: ``where('a.b.c')`` is now
``Query()['a.b.c']``.

- Checking for the existence of a key has to be done explicitely:
``where('foo').exists()``.

- Migrations from v1 to v2 have been removed.
- ``SmartCacheTable`` has been moved to `msiemens/tinydb-smartcache`_.
- Serialization has been moved to `msiemens/tinydb-serialization`_.
- Empty storages are now expected to return ``None`` instead of raising ``ValueError``.
(see `issue 67 <https://github.com/msiemens/tinydb/issues/67>`_.

.. _msiemens/tinydb-smartcache: https://github.com/msiemens/tinydb-smartcache
.. _msiemens/tinydb-serialization: https://github.com/msiemens/tinydb-serialization

2.4.0

^^^^^^^^^^^^^^^^^^^

- Allow custom parameters for custom test functions
(see `issue 63 <https://github.com/msiemens/tinydb/issues/63>`_ and
`pull request 64 <https://github.com/msiemens/tinydb/pull/64>`_).

2.3.2

^^^^^^^^^^^^^^^^^^^

- Fix a forgotten debug output in the ``SerializationMiddleware``
(see `issue 55 <https://github.com/msiemens/tinydb/issues/55>`_).
- Fix an "ignored exception" warning when using the ``CachingMiddleware``
(see `pull request 54 <https://github.com/msiemens/tinydb/pull/54>`_)
- Fix a problem with symlinks when checking out TinyDB on OSX Yosemite
(see `issue 52 <https://github.com/msiemens/tinydb/issues/52>`_).

2.3.1

^^^^^^^^^^^^^^^^^^^

- Hopefully fix a problem with using TinyDB as a dependency in a ``setup.py`` script
(see `issue 51 <https://github.com/msiemens/tinydb/issues/51>`_).

2.3.0

^^^^^^^^^^^^^^^^^^^

- Added support for custom serialization. That way, you can teach TinyDB
to store ``datetime`` objects in a JSON file :)
(see `issue 48 <https://github.com/msiemens/tinydb/issues/48>`_ and
`pull request 50 <https://github.com/msiemens/tinydb/pull/50>`_)
- Fixed a performance regression when searching became slower with every search
(see `issue 49 <https://github.com/msiemens/tinydb/issues/49>`_)
- Internal code has been cleaned up

2.2.2

^^^^^^^^^^^^^^^^^^^

- Fixed a data loss when using ``CachingMiddleware`` together with ``JSONStorage``
(see `issue 47 <https://github.com/msiemens/tinydb/issues/47>`_)

2.2.1

^^^^^^^^^^^^^^^^^^^

- Fixed handling of IDs with the JSON backend that converted integers
to strings (see `issue 45 <https://github.com/msiemens/tinydb/issues/45>`_)

2.2.0

^^^^^^^^^^^^^^^^^^^

- Extended ``any`` and ``all`` queries to take lists as conditions
(see `pull request 38 <https://github.com/msiemens/tinydb/pull/38>`_)
- Fixed an ``decode error`` when installing TinyDB in a non-UTF-8 environment
(see `pull request 37 <https://github.com/msiemens/tinydb/pull/37>`_)
- Fixed some issues with ``CachingMiddleware`` in combination with
``JSONStorage`` (see `pull request 39 <https://github.com/msiemens/tinydb/pull/39>`_)

2.1.0

^^^^^^^^^^^^^^^^^^^

- Added ``where(...).contains(regex)``
(see `issue 32 <https://github.com/msiemens/tinydb/issues/32>`_)
- Fixed a bug that corrupted data after reopening a database
(see `issue 34 <https://github.com/msiemens/tinydb/issues/34>`_)

2.0.1

^^^^^^^^^^^^^^^^^^^

- Fixed handling of Unicode data in Python 2
(see `issue 28 <https://github.com/msiemens/tinydb/issues/28>`_).

2.0.0

^^^^^^^^^^^^^^^^^^^

:ref:`Upgrade Notes <upgrade_v2_0>`

.. warning:: TinyDB changed the way data is stored. You may need to migrate
your databases to the new scheme. Check out the
:ref:`Upgrade Notes <upgrade_v2_0>` for details.

- The syntax ``query in db`` has been removed, use ``db.contains`` instead.
- The ``ConcurrencyMiddleware`` has been removed due to a insecure implementation
(see `issue 18 <https://github.com/msiemens/tinydb/issues/18>`_). Consider
:ref:`tinyrecord` instead.

- Better support for working with :ref:`Document IDs <document_ids>`.
- Added support for `nested comparisons <http://tinydb.readthedocs.io/en/v2.0.0/usage.html#nested-queries>`_.
- Added ``all`` and ``any`` `comparisons on lists <http://tinydb.readthedocs.io/en/v2.0.0/usage.html#nested-queries>`_.
- Added optional :<http://tinydb.readthedocs.io/en/v2.0.0/usage.html#smart-query-cache>`_.
- The query cache is now a :ref:`fixed size LRU cache <query_caching>`.

1.4.0

Not secure
^^^^^^^^^^^^^^^^^^^

- Added ``insert_multiple`` function
(see `issue 8 <https://github.com/msiemens/tinydb/issues/8>`_).

1.3.0

Not secure
^^^^^^^^^^^^^^^^^^^

- Fixed `bug 7 <https://github.com/msiemens/tinydb/issues/7>`_: IDs not unique.
- Extended the API: ``db.count(where(...))`` and ``db.contains(where(...))``.
- The syntax ``query in db`` is now **deprecated** and replaced
by ``db.contains``.

1.2.0

Not secure
^^^^^^^^^^^^^^^^^^^

- Added ``update`` method
(see `issue 6 <https://github.com/msiemens/tinydb/issues/6>`_).

1.1.1

Not secure
^^^^^^^^^^^^^^^^^^^

- Merged `PR 5 <https://github.com/msiemens/tinydb/pull/5>`_: Fix minor
documentation typos and style issues.

1.1.0

Not secure
^^^^^^^^^^^^^^^^^^^

- Improved the docs and fixed some typos.
- Refactored some internal code.
- Fixed a bug with multiple ``TinyDB?`` instances.

1.0.1

Not secure
^^^^^^^^^^^^^^^^^^^

- Fixed a bug in ``JSONStorage`` that broke the database when removing entries.

1.0.0

Not secure
^^^^^^^^^^^^^^^^^^^

- First official release – consider TinyDB stable now.