]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
accomodate schema translate keys present or not present
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 27 Jun 2023 14:17:36 +0000 (10:17 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 27 Jun 2023 16:59:05 +0000 (12:59 -0400)
commit51b65467e1c4150c4b594ac490eafd6d721d7459
tree45acef86406bd21624dc33a10712cd13085d70f9
parentbf5cb5268c0d12f44c1537abfef1a1244b2982bb
accomodate schema translate keys present or not present

Adjusted the :paramref:`_sa.create_engine.schema_translate_map` feature
such that **all** schema names in the statement are now tokenized,
regardless of whether or not a specific name is in the immediate schema
translate map given, and to fallback to substituting the original name when
the key is not in the actual schema translate map at execution time.  These
two changes allow for repeated use of a compiled object with schema
schema_translate_maps that include or dont include various keys on each
run, allowing cached SQL constructs to continue to function at runtime when
schema translate maps with different sets of keys are used each time. In
addition, added detection of schema_translate_map dictionaries which gain
or lose a ``None`` key across calls for the same statement, which affects
compilation of the statement and is not compatible with caching; an
exception is raised for these scenarios.

Fixes: #10025
Change-Id: I6f5e0c8e067d1702a3647b6251af483669ad854b
doc/build/changelog/unreleased_20/10025.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
test/engine/test_execute.py