]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
new pre-caching architecture for autogenerate
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 22 Dec 2025 15:40:06 +0000 (10:40 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 8 Jan 2026 22:50:49 +0000 (17:50 -0500)
commitb1a287f868577e9ee338ec571b86bfdcc2050183
treef899281fa4250b39e2b1d55ce81b1ed23800c529
parentf532224351f75467c6a90962f1edbb0abd162f41
new pre-caching architecture for autogenerate

Autogenerate reflection sweeps now use the "bulk" inspector methods
introduced in SQLAlchemy 2.0, which for selected dialects including
PostgreSQL and Oracle use batched queries to reflect whole collections of
tables using O(1) queries rather than O(N).

This is the original proposed version that uses the Inspector
entirely with its public API, with the exception of reflect_table()
which makes a _ReflectionInfo on a per-table basis.  Other than
that, no private API assumptions are made.

If SQLAlchemy needed to add new fields to _ReflectionInfo, it just
needs to make sure they have default functions (which all the current fields
should have anyway, since there is even a ReflectionDefaults
constant that already provides these!)

This version is the one that does not imply any particular
changes in SQLAlchemy and does not have any sqla_compat logic,
so that we may have alembic using the new performance enhancements
allowing for SQLAlchemy to potentially improve its API for a later
release.

Other than that, typing of reflection functions is improved.

Fixes: #1771
Change-Id: I7b9a75fa81cefc377fdb1a22fc1cfc3da1765769
alembic/autogenerate/compare/constraints.py
alembic/autogenerate/compare/tables.py
alembic/autogenerate/compare/util.py
alembic/ddl/impl.py
alembic/ddl/mssql.py
alembic/ddl/postgresql.py
docs/build/unreleased/1771.rst [new file with mode: 0644]
tests/test_autogen_diffs.py