Skip to content

docs: explain moving documents between databases#622

Open
uadhran wants to merge 1 commit into
msiemens:masterfrom
uadhran:docs/354-move-documents
Open

docs: explain moving documents between databases#622
uadhran wants to merge 1 commit into
msiemens:masterfrom
uadhran:docs/354-move-documents

Conversation

@uadhran

@uadhran uadhran commented Jul 1, 2026

Copy link
Copy Markdown

Documents returned from TinyDB are Document wrappers that retain their
doc_id. Inserting them into another table or database reuses that ID and
can raise ValueError if the target already has that ID.

This documents the dict(document) workaround described by the maintainer
in #354.

Changes

  • Add Moving documents between databases section to docs/usage.rst
  • Add test_move_document_between_tables covering the doc_id conflict and fix

Verification

  • uv run py.test -v --cov=tinydb — 218 passed
  • uv run py.test -v --pycodestyle — not run (pre-existing failures on master)

Related: #354

Document that Document instances retain their doc_id when inserted into
another table or database, and show the dict(document) workaround from
issue msiemens#354.

Add test_move_document_between_tables to cover the conflict and fix.

Related: msiemens#354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant