]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
add check for pre-existing history records
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Aug 2024 20:41:45 +0000 (16:41 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Aug 2024 20:41:45 +0000 (16:41 -0400)
commit6a59eecfa891db84033f5d0c88451b344e5b6f0c
tree822b81e398cc3c3eea446c55598326c7f0cbeda7
parent92f07890784d3497b1e7735badf9f6e78eefd70d
add check for pre-existing history records

Fixed issue in history_meta example where the "version" column in the
versioned table needs to default to the most recent version number in the
history table on INSERT, to suit the use case of a table where rows are
deleted, and can then be replaced by new rows that re-use the same primary
key identity.  This fix adds an additonal SELECT query per INSERT in the
main table, which may be inefficient; for cases where primary keys are not
re-used, the default function may be omitted.  Patch courtesy  Philipp H.
v. Loewenfeld.

Fixes: #10267
Change-Id: I6b0737a7e871763f95fd636c9ad98b80f3b5808e
doc/build/changelog/unreleased_20/10267.rst [new file with mode: 0644]
examples/versioned_history/__init__.py
examples/versioned_history/history_meta.py
examples/versioned_history/test_versioning.py