summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-11-08 18:29:16 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-09 15:30:58 -0500
commitb919a0a85afd5066f9188b20ef06ee1b4af884a9 (patch)
tree39536ce18d644aae3488905ba501aeffcee8337b /doc
parentcf404d840c15fe167518dd884b295dc99ee26178 (diff)
downloadsqlalchemy-b919a0a85afd5066f9188b20ef06ee1b4af884a9.tar.gz
change the POSTCOMPILE/ SCHEMA symbols to not conflict w mssql quoting
Adjusted the compiler's generation of "post compile" symbols including those used for "expanding IN" as well as for the "schema translate map" to not be based directly on plain bracketed strings with underscores, as this conflicts directly with SQL Server's quoting format of also using brackets, which produces false matches when the compiler replaces "post compile" and "schema translate" symbols. The issue created easy to reproduce examples both with the :meth:`.Inspector.get_schema_names` method when used in conjunction with the :paramref:`_engine.Connection.execution_options.schema_translate_map` feature, as well in the unlikely case that a symbol overlapping with the internal name "POSTCOMPILE" would be used with a feature like "expanding in". Fixes: #7300 Change-Id: I6255c850b140522a4aba95085216d0bca18ce230
Diffstat (limited to 'doc')
-rw-r--r--doc/build/changelog/unreleased_14/7300.rst17
-rw-r--r--doc/build/core/operators.rst10
2 files changed, 22 insertions, 5 deletions
diff --git a/doc/build/changelog/unreleased_14/7300.rst b/doc/build/changelog/unreleased_14/7300.rst
new file mode 100644
index 000000000..d9061af09
--- /dev/null
+++ b/doc/build/changelog/unreleased_14/7300.rst
@@ -0,0 +1,17 @@
+.. change::
+ :tags: mssql, bug
+ :tickets: 7300
+
+ Adjusted the compiler's generation of "post compile" symbols including
+ those used for "expanding IN" as well as for the "schema translate map" to
+ not be based directly on plain bracketed strings with underscores, as this
+ conflicts directly with SQL Server's quoting format of also using brackets,
+ which produces false matches when the compiler replaces "post compile" and
+ "schema translate" symbols. The issue created easy to reproduce examples
+ both with the :meth:`.Inspector.get_schema_names` method when used in
+ conjunction with the
+ :paramref:`_engine.Connection.execution_options.schema_translate_map`
+ feature, as well in the unlikely case that a symbol overlapping with the
+ internal name "POSTCOMPILE" would be used with a feature like "expanding
+ in".
+
diff --git a/doc/build/core/operators.rst b/doc/build/core/operators.rst
index 8d962560d..d119db1e0 100644
--- a/doc/build/core/operators.rst
+++ b/doc/build/core/operators.rst
@@ -172,9 +172,9 @@ values to the :meth:`_sql.ColumnOperators.in_` method::
>>> print(column('x').in_([1, 2, 3]))
- x IN ([POSTCOMPILE_x_1])
+ x IN (__[POSTCOMPILE_x_1])
-The special bound form ``POSTCOMPILE`` is rendered into individual parameters
+The special bound form ``__[POSTCOMPILE`` is rendered into individual parameters
at execution time, illustrated below:
.. sourcecode:: pycon+sql
@@ -212,12 +212,12 @@ NOT IN
"NOT IN" is available via the :meth:`_sql.ColumnOperators.not_in` operator::
>>> print(column('x').not_in([1, 2, 3]))
- (x NOT IN ([POSTCOMPILE_x_1]))
+ (x NOT IN (__[POSTCOMPILE_x_1]))
This is typically more easily available by negating with the ``~`` operator::
>>> print(~column('x').in_([1, 2, 3]))
- (x NOT IN ([POSTCOMPILE_x_1]))
+ (x NOT IN (__[POSTCOMPILE_x_1]))
Tuple IN Expressions
~~~~~~~~~~~~~~~~~~~~
@@ -232,7 +232,7 @@ then receives a list of tuples::
>>> tup = tuple_(column('x', Integer), column('y', Integer))
>>> expr = tup.in_([(1, 2), (3, 4)])
>>> print(expr)
- (x, y) IN ([POSTCOMPILE_param_1])
+ (x, y) IN (__[POSTCOMPILE_param_1])
To illustrate the parameters rendered: