]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
support monotonic functions as sentinels
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 1 Dec 2025 16:07:24 +0000 (11:07 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 7 Dec 2025 13:51:13 +0000 (08:51 -0500)
commit437745e92e0cfe172cfb75a55f3476942fc1c81d
tree286fec6b8413345fad0fcda496c8b8a2f5143749
parent9a0d00433134b44a132104618b96516e47fff224
support monotonic functions as sentinels

Added support for monotonic server-side functions such as PostgreSQL 18's
``uuidv7()`` to work with the :ref:`engine_insertmanyvalues` feature.
By passing ``monotonic=True`` to any :class:`.Function`, the function can
be used as a sentinel for tracking row order in batched INSERT operations
with RETURNING, allowing the ORM and Core to efficiently batch INSERT
statements while maintaining deterministic row ordering.

Fixes: #13014
Change-Id: I2fabf96c8fbdb6c1d255fd4781cbd31fed17e1e9
doc/build/changelog/migration_21.rst
doc/build/changelog/unreleased_21/13014.rst [new file with mode: 0644]
doc/build/core/connections.rst
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/functions.py
lib/sqlalchemy/sql/schema.py
test/dialect/postgresql/test_query.py