]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add has_multi_table reflection method
authorFederico Caselli <cfederico87@gmail.com>
Thu, 21 May 2026 21:05:07 +0000 (23:05 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Wed, 22 Jul 2026 19:20:53 +0000 (21:20 +0200)
commite32fe92a836b7146c76d4ad9b72ca815831bf35d
tree4a81e08cc99ddaa155e525a17977c7c1fa9fa587
parent16177b8c73e492e5adaad8f51095f9981831da41
Add has_multi_table reflection method

Created new reflection method :meth:`_engine.Inspector.has_multi_table`
to check the existence of multiple tables at once, allowing for
better performance when checking many tables. Like the other "multi"
reflection methods, the default dialect offers a default implementation
that just call the single method in a loop. Backends that wish to take
advantage of this new method can implement it in their dialects.
The PostgreSQL, Oracle and SQL Server dialects have been updated to use
this new method.
The implementation of :meth:`_schema.MetaData.create_all` has been updated
to make use of this new method to check the existence of the tables,
reducing the number of round trips to the database when creating many tables.

Fixes: #13311
Change-Id: I75a660fc9d5d5df88a277a792c56058b8355ed0c
doc/build/changelog/unreleased_21/13311.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/interfaces.py
lib/sqlalchemy/engine/reflection.py
lib/sqlalchemy/sql/ddl.py
lib/sqlalchemy/testing/suite/test_reflection.py
test/perf/many_table_reflection.py
test/sql/test_ddlemit.py