]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
change the POSTCOMPILE/ SCHEMA symbols to not conflict w mssql quoting
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 8 Nov 2021 23:29:16 +0000 (18:29 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 9 Nov 2021 20:30:58 +0000 (15:30 -0500)
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

34 files changed:
doc/build/changelog/unreleased_14/7300.rst [new file with mode: 0644]
doc/build/core/operators.rst
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/testing/suite/test_reflection.py
lib/sqlalchemy/testing/suite/test_select.py
test/dialect/mssql/test_compiler.py
test/dialect/mssql/test_query.py
test/dialect/oracle/test_compiler.py
test/dialect/postgresql/test_types.py
test/dialect/test_sqlite.py
test/engine/test_execute.py
test/orm/declarative/test_mixin.py
test/orm/inheritance/test_deprecations.py
test/orm/inheritance/test_poly_loading.py
test/orm/inheritance/test_relationship.py
test/orm/inheritance/test_single.py
test/orm/test_ac_relationships.py
test/orm/test_deferred.py
test/orm/test_deprecations.py
test/orm/test_froms.py
test/orm/test_lockmode.py
test/orm/test_of_type.py
test/orm/test_query.py
test/orm/test_relationship_criteria.py
test/orm/test_relationships.py
test/orm/test_selectin_relations.py
test/sql/test_compiler.py
test/sql/test_deprecations.py
test/sql/test_external_traversal.py
test/sql/test_lambdas.py
test/sql/test_operators.py
test/sql/test_selectable.py
test/sql/test_type_expressions.py

diff --git a/doc/build/changelog/unreleased_14/7300.rst b/doc/build/changelog/unreleased_14/7300.rst
new file mode 100644 (file)
index 0000000..d9061af
--- /dev/null
@@ -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".
+
index 8d962560d5808b76459afe71882410a4c496991d..d119db1e0ccb98c52acdc27756f268f697c690fd 100644 (file)
@@ -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:
 
index 8c8260f3bb9b3da7a484eebc914fa45660451b6b..cefaad41d8cb6ef43b30d515a1b609402531db39 100644 (file)
@@ -2615,6 +2615,9 @@ def _schema_elements(schema):
     # test/dialect/mssql/test_compiler.py -> test_schema_many_tokens_*
     #
 
+    if schema.startswith("__[SCHEMA_"):
+        return None, schema
+
     push = []
     symbol = ""
     bracket = False
index 4611c5e13c7788555a2cd10a2cffd0b0d5d7bda7..8ea35099de9ac9f9caa1a287b77f173c85533b9f 100644 (file)
@@ -1247,7 +1247,7 @@ class SQLCompiler(Compiled):
             return expr
 
         statement = re.sub(
-            r"\[POSTCOMPILE_(\S+?)(~~.+?~~)?\]",
+            r"__\[POSTCOMPILE_(\S+?)(~~.+?~~)?\]",
             process_expanding,
             self.string,
         )
@@ -2374,9 +2374,9 @@ class SQLCompiler(Compiled):
                     # for postcompile w/ expanding, move the "wrapped" part
                     # of this into the inside
                     m = re.match(
-                        r"^(.*)\(\[POSTCOMPILE_(\S+?)\]\)(.*)$", wrapped
+                        r"^(.*)\(__\[POSTCOMPILE_(\S+?)\]\)(.*)$", wrapped
                     )
-                    wrapped = "([POSTCOMPILE_%s~~%s~~REPL~~%s~~])" % (
+                    wrapped = "(__[POSTCOMPILE_%s~~%s~~REPL~~%s~~])" % (
                         m.group(2),
                         m.group(1),
                         m.group(3),
@@ -2582,7 +2582,7 @@ class SQLCompiler(Compiled):
                 self.escaped_bind_names = {}
             self.escaped_bind_names[escaped_from] = name
         if post_compile:
-            return "[POSTCOMPILE_%s]" % name
+            return "__[POSTCOMPILE_%s]" % name
         else:
             return self.bindtemplate % {"name": name}
 
@@ -5039,7 +5039,7 @@ class IdentifierPreparer(object):
                         "in schema translate name '%s'" % name
                     )
                 return quoted_name(
-                    "[SCHEMA_%s]" % (name or "_none"), quote=False
+                    "__[SCHEMA_%s]" % (name or "_none"), quote=False
                 )
             else:
                 return obj.schema
@@ -5065,7 +5065,7 @@ class IdentifierPreparer(object):
                     )
             return self.quote_schema(effective_schema)
 
-        return re.sub(r"(\[SCHEMA_([^\]]+)\])", replace, statement)
+        return re.sub(r"(__\[SCHEMA_([^\]]+)\])", replace, statement)
 
     def _escape_identifier(self, value):
         """Escape an identifier.
index 6fbd7468914d44f8aa2960f0ffb08d2e33218252..ba176bcd91728f0b596d96989f5f319b926104d4 100644 (file)
@@ -2,7 +2,6 @@ import operator
 import re
 
 import sqlalchemy as sa
-from sqlalchemy import func
 from .. import config
 from .. import engines
 from .. import eq_
@@ -15,6 +14,7 @@ from ..schema import Column
 from ..schema import Table
 from ... import event
 from ... import ForeignKey
+from ... import func
 from ... import Identity
 from ... import inspect
 from ... import Integer
@@ -25,6 +25,7 @@ from ... import types as sql_types
 from ...schema import DDL
 from ...schema import Index
 from ...sql.elements import quoted_name
+from ...sql.schema import BLANK_SCHEMA
 from ...testing import is_false
 from ...testing import is_true
 
@@ -538,6 +539,20 @@ class ComponentReflectionTest(fixtures.TablesTest):
 
         self.assert_(testing.config.test_schema in insp.get_schema_names())
 
+    @testing.requires.schema_reflection
+    def test_get_schema_names_w_translate_map(self, connection):
+        """test #7300"""
+
+        connection = connection.execution_options(
+            schema_translate_map={
+                "foo": "bar",
+                BLANK_SCHEMA: testing.config.test_schema,
+            }
+        )
+        insp = inspect(connection)
+
+        self.assert_(testing.config.test_schema in insp.get_schema_names())
+
     @testing.requires.schema_reflection
     def test_dialect_initialize(self):
         engine = engines.testing_engine()
index bea8a60751aa384b9c39f0e0bc375c799d9b1cce..b5a3dca3a1672db1f96df2d8cec64076dd6eb5d5 100644 (file)
@@ -884,7 +884,7 @@ class PostCompileParamsTest(
         self.assert_compile(
             stmt,
             "SELECT some_table.id FROM some_table "
-            "WHERE some_table.x = [POSTCOMPILE_q]",
+            "WHERE some_table.x = __[POSTCOMPILE_q]",
             {},
         )
 
index dc6805a2bcb8952c10c9fec79f234227c88cb263..e9ff8fb19d6e5a0b264bd38720700c32bb8f68ed 100644 (file)
@@ -333,8 +333,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
     @testing.combinations(
         (
             lambda: select(literal("x"), literal("y")),
-            "SELECT [POSTCOMPILE_param_1] AS anon_1, "
-            "[POSTCOMPILE_param_2] AS anon_2",
+            "SELECT __[POSTCOMPILE_param_1] AS anon_1, "
+            "__[POSTCOMPILE_param_2] AS anon_2",
             {
                 "check_literal_execute": {"param_1": "x", "param_2": "y"},
                 "check_post_param": {},
@@ -343,7 +343,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         (
             lambda t: select(t).where(t.c.foo.in_(["x", "y", "z"])),
             "SELECT sometable.foo FROM sometable WHERE sometable.foo "
-            "IN ([POSTCOMPILE_foo_1])",
+            "IN (__[POSTCOMPILE_foo_1])",
             {
                 "check_literal_execute": {"foo_1": ["x", "y", "z"]},
                 "check_post_param": {},
@@ -435,7 +435,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         crit = q.c.myid == table1.c.myid
         self.assert_compile(
             select("*").where(crit),
-            "SELECT * FROM (SELECT TOP [POSTCOMPILE_param_1] mytable.myid AS "
+            "SELECT * FROM (SELECT TOP __[POSTCOMPILE_param_1] "
+            "mytable.myid AS "
             "myid FROM mytable ORDER BY mytable.myid) AS foo, mytable WHERE "
             "foo.myid = mytable.myid",
         )
@@ -809,10 +810,10 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         self.assert_compile(
             u,
             "SELECT t1.col3 AS col3, t1.col4 AS col4 "
-            "FROM t1 WHERE t1.col2 IN ([POSTCOMPILE_col2_1]) "
+            "FROM t1 WHERE t1.col2 IN (__[POSTCOMPILE_col2_1]) "
             "UNION SELECT t2.col3 AS col3, "
             "t2.col4 AS col4 FROM t2 WHERE t2.col2 IN "
-            "([POSTCOMPILE_col2_2]) ORDER BY col3, col4",
+            "(__[POSTCOMPILE_col2_2]) ORDER BY col3, col4",
             checkparams={
                 "col2_1": ["t1col2r1", "t1col2r2"],
                 "col2_2": ["t2col2r2", "t2col2r3"],
@@ -822,9 +823,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             u.alias("bar").select(),
             "SELECT bar.col3, bar.col4 FROM (SELECT "
             "t1.col3 AS col3, t1.col4 AS col4 FROM t1 "
-            "WHERE t1.col2 IN ([POSTCOMPILE_col2_1]) UNION "
+            "WHERE t1.col2 IN (__[POSTCOMPILE_col2_1]) UNION "
             "SELECT t2.col3 AS col3, t2.col4 AS col4 "
-            "FROM t2 WHERE t2.col2 IN ([POSTCOMPILE_col2_2])) AS bar",
+            "FROM t2 WHERE t2.col2 IN (__[POSTCOMPILE_col2_2])) AS bar",
             checkparams={
                 "col2_1": ["t1col2r1", "t1col2r2"],
                 "col2_2": ["t2col2r2", "t2col2r3"],
@@ -971,7 +972,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             s,
-            "SELECT TOP [POSTCOMPILE_param_1] t.x, t.y FROM t "
+            "SELECT TOP __[POSTCOMPILE_param_1] t.x, t.y FROM t "
             "WHERE t.x = :x_1 ORDER BY t.y",
             checkparams={"x_1": 5, "param_1": 10},
         )
@@ -999,7 +1000,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             s,
-            "SELECT TOP [POSTCOMPILE_param_1] t.x, t.y FROM t "
+            "SELECT TOP __[POSTCOMPILE_param_1] t.x, t.y FROM t "
             "WHERE t.x = :x_1 ORDER BY t.y",
             checkparams={"x_1": 5, "param_1": 0},
         )
@@ -1200,7 +1201,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         # of zero, so produces TOP 0
         self.assert_compile(
             s,
-            "SELECT TOP [POSTCOMPILE_param_1] t.x, t.y FROM t "
+            "SELECT TOP __[POSTCOMPILE_param_1] t.x, t.y FROM t "
             "WHERE t.x = :x_1 ORDER BY t.y",
             checkparams={"x_1": 5, "param_1": 0},
         )
@@ -1444,21 +1445,21 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             5,
             0,
             {"percent": True},
-            "TOP [POSTCOMPILE_param_1] PERCENT",
+            "TOP __[POSTCOMPILE_param_1] PERCENT",
             {"param_1": 5},
         ),
         (
             5,
             None,
             {"percent": True, "with_ties": True},
-            "TOP [POSTCOMPILE_param_1] PERCENT WITH TIES",
+            "TOP __[POSTCOMPILE_param_1] PERCENT WITH TIES",
             {"param_1": 5},
         ),
         (
             5,
             0,
             {"with_ties": True},
-            "TOP [POSTCOMPILE_param_1] WITH TIES",
+            "TOP __[POSTCOMPILE_param_1] WITH TIES",
             {"param_1": 5},
         ),
         (
@@ -1536,21 +1537,21 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             5,
             0,
             {"percent": True},
-            "TOP [POSTCOMPILE_param_1] PERCENT",
+            "TOP __[POSTCOMPILE_param_1] PERCENT",
             {"param_1": 5},
         ),
         (
             5,
             None,
             {"percent": True, "with_ties": True},
-            "TOP [POSTCOMPILE_param_1] PERCENT WITH TIES",
+            "TOP __[POSTCOMPILE_param_1] PERCENT WITH TIES",
             {"param_1": 5},
         ),
         (
             5,
             0,
             {"with_ties": True},
-            "TOP [POSTCOMPILE_param_1] WITH TIES",
+            "TOP __[POSTCOMPILE_param_1] WITH TIES",
             {"param_1": 5},
         ),
         (
index 2498de92a95921fe5a851dd047bdcff213c6e403..63b2551cd54a8c429ea9c17ccb8cb333b9aa7166 100644 (file)
@@ -220,6 +220,21 @@ class QueryTest(testing.AssertsExecutionResults, fixtures.TestBase):
         r = connection.execute(t1.insert(), dict(descr="hello"))
         eq_(r.inserted_primary_key, (100,))
 
+    def test_compiler_symbol_conflict(self, connection, metadata):
+        t = Table("t", metadata, Column("POSTCOMPILE_DATA", String(50)))
+
+        t.create(connection)
+
+        connection.execute(t.insert().values(POSTCOMPILE_DATA="some data"))
+        eq_(
+            connection.scalar(
+                select(t.c.POSTCOMPILE_DATA).where(
+                    t.c.POSTCOMPILE_DATA.in_(["some data", "some other data"])
+                )
+            ),
+            "some data",
+        )
+
     @testing.provide_metadata
     def _test_disable_scope_identity(self):
         engine = engines.testing_engine(options={"use_scope_identity": False})
index 08158eed4707655ed26fae64109ef2202f0f2551..22ffc888ab088e2f6ba7387c60d2735f35d7db7a 100644 (file)
@@ -101,7 +101,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
     def test_bindparam_quote_works_on_expanding(self):
         self.assert_compile(
             bindparam("uid", expanding=True),
-            "([POSTCOMPILE_uid])",
+            "(__[POSTCOMPILE_uid])",
             dialect=cx_oracle.dialect(),
         )
 
@@ -164,9 +164,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "anon_2.col2 AS col2, ROWNUM AS ora_rn FROM (SELECT "
             "sometable.col1 AS col1, sometable.col2 AS "
             "col2 FROM sometable) anon_2 WHERE ROWNUM <= "
-            "[POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) anon_1 "
+            "__[POSTCOMPILE_param_1] + __[POSTCOMPILE_param_2]) anon_1 "
             "WHERE ora_rn > "
-            "[POSTCOMPILE_param_2]",
+            "__[POSTCOMPILE_param_2]",
             checkparams={"param_1": 10, "param_2": 20},
         )
 
@@ -203,14 +203,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         self.assert_compile(
             s,
             "SELECT anon_1.col1, anon_1.col2 FROM "
-            "(SELECT /*+ FIRST_ROWS([POSTCOMPILE_param_1]) */ "
+            "(SELECT /*+ FIRST_ROWS(__[POSTCOMPILE_param_1]) */ "
             "anon_2.col1 AS col1, "
             "anon_2.col2 AS col2, ROWNUM AS ora_rn FROM (SELECT "
             "sometable.col1 AS col1, sometable.col2 AS "
             "col2 FROM sometable) anon_2 WHERE ROWNUM <= "
-            "[POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) anon_1 "
+            "__[POSTCOMPILE_param_1] + __[POSTCOMPILE_param_2]) anon_1 "
             "WHERE ora_rn > "
-            "[POSTCOMPILE_param_2]",
+            "__[POSTCOMPILE_param_2]",
             checkparams={"param_1": 10, "param_2": 20},
             dialect=oracle.OracleDialect(optimize_limits=True),
         )
@@ -229,9 +229,10 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "ROWNUM AS ora_rn "
             "FROM (SELECT sometable.col1 AS col1, "
             "sometable.col2 AS col2 FROM sometable) anon_3 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) "
             "anon_2 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2]) anon_1",
+            "WHERE ora_rn > __[POSTCOMPILE_param_2]) anon_1",
             checkparams={"param_1": 10, "param_2": 20},
         )
 
@@ -244,9 +245,10 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "ROWNUM AS ora_rn "
             "FROM (SELECT sometable.col1 AS col1, "
             "sometable.col2 AS col2 FROM sometable) anon_3 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) "
             "anon_2 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2]) anon_1",
+            "WHERE ora_rn > __[POSTCOMPILE_param_2]) anon_1",
         )
         c = s2.compile(dialect=oracle.OracleDialect())
         eq_(len(c._result_columns), 2)
@@ -264,8 +266,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "sometable.col1 AS col1, sometable.col2 AS "
             "col2 FROM sometable ORDER BY "
             "sometable.col2) anon_2 WHERE ROWNUM <= "
-            "[POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2]",
+            "__[POSTCOMPILE_param_1] + __[POSTCOMPILE_param_2]) anon_1 "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2]",
             checkparams={"param_1": 10, "param_2": 20},
         )
         c = s.compile(dialect=oracle.OracleDialect())
@@ -281,7 +283,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "SELECT anon_1.col1, anon_1.col2 FROM (SELECT "
             "sometable.col1 AS col1, sometable.col2 AS "
             "col2 FROM sometable ORDER BY "
-            "sometable.col2) anon_1 WHERE ROWNUM <= [POSTCOMPILE_param_1] "
+            "sometable.col2) anon_1 WHERE ROWNUM <= __[POSTCOMPILE_param_1] "
             "FOR UPDATE",
             checkparams={"param_1": 10},
         )
@@ -292,11 +294,11 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         s = select(t).with_for_update().limit(10).order_by(t.c.col2)
         self.assert_compile(
             s,
-            "SELECT /*+ FIRST_ROWS([POSTCOMPILE_param_1]) */ "
+            "SELECT /*+ FIRST_ROWS(__[POSTCOMPILE_param_1]) */ "
             "anon_1.col1, anon_1.col2 FROM (SELECT "
             "sometable.col1 AS col1, sometable.col2 AS "
             "col2 FROM sometable ORDER BY "
-            "sometable.col2) anon_1 WHERE ROWNUM <= [POSTCOMPILE_param_1] "
+            "sometable.col2) anon_1 WHERE ROWNUM <= __[POSTCOMPILE_param_1] "
             "FOR UPDATE",
             checkparams={"param_1": 10},
             dialect=oracle.OracleDialect(optimize_limits=True),
@@ -314,8 +316,8 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "sometable.col1 AS col1, sometable.col2 AS "
             "col2 FROM sometable ORDER BY "
             "sometable.col2) anon_2 WHERE ROWNUM <= "
-            "[POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2] FOR "
+            "__[POSTCOMPILE_param_1] + __[POSTCOMPILE_param_2]) anon_1 "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2] FOR "
             "UPDATE",
             checkparams={"param_1": 10, "param_2": 20},
         )
@@ -335,7 +337,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "col1, anon_2.col2 AS col2, ROWNUM AS ora_rn FROM "
             "(SELECT sometable.col1 AS col1, sometable.col2 AS col2 "
             "FROM sometable ORDER BY sometable.col2) anon_2 WHERE "
-            "ROWNUM <= [POSTCOMPILE_param_1] + :param_2 + :param_3) anon_1 "
+            "ROWNUM <= __[POSTCOMPILE_param_1] + :param_2 + :param_3) anon_1 "
             "WHERE ora_rn > :param_2 + :param_3",
             checkparams={"param_1": 10, "param_2": 10, "param_3": 20},
         )
@@ -357,7 +359,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             'SELECT anon_1."SUM(ABC)" FROM '
             '(SELECT SUM(ABC) AS "SUM(ABC)" '
             "FROM my_table ORDER BY SUM(ABC)) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1]",
         )
 
         col = literal_column("SUM(ABC)").label(quoted_name("SUM(ABC)", True))
@@ -369,7 +371,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             'SELECT anon_1."SUM(ABC)" FROM '
             '(SELECT SUM(ABC) AS "SUM(ABC)" '
             "FROM my_table ORDER BY SUM(ABC)) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1]",
         )
 
         col = literal_column("SUM(ABC)").label("SUM(ABC)_")
@@ -381,7 +383,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             'SELECT anon_1."SUM(ABC)_" FROM '
             '(SELECT SUM(ABC) AS "SUM(ABC)_" '
             "FROM my_table ORDER BY SUM(ABC)) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1]",
         )
 
         col = literal_column("SUM(ABC)").label(quoted_name("SUM(ABC)_", True))
@@ -393,7 +395,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             'SELECT anon_1."SUM(ABC)_" FROM '
             '(SELECT SUM(ABC) AS "SUM(ABC)_" '
             "FROM my_table ORDER BY SUM(ABC)) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1]",
         )
 
     def test_for_update(self):
@@ -511,7 +513,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "SELECT anon_1.myid, anon_1.name FROM "
             "(SELECT mytable.myid AS myid, mytable.name AS name "
             "FROM mytable WHERE mytable.myid = :myid_1) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] "
             "FOR UPDATE OF anon_1.name NOWAIT",
             checkparams={"param_1": 10, "myid_1": 7},
         )
@@ -527,7 +529,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "SELECT anon_1.myid FROM "
             "(SELECT mytable.myid AS myid, mytable.name AS name "
             "FROM mytable WHERE mytable.myid = :myid_1) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] "
             "FOR UPDATE OF anon_1.name NOWAIT",
         )
 
@@ -545,9 +547,10 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "ROWNUM AS ora_rn "
             "FROM (SELECT mytable.myid AS myid, mytable.name AS name "
             "FROM mytable WHERE mytable.myid = :myid_1) anon_2 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) "
             "anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2] "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2] "
             "FOR UPDATE OF anon_1.name NOWAIT",
             checkparams={"param_1": 10, "param_2": 50, "myid_1": 7},
         )
@@ -566,8 +569,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "FROM (SELECT mytable.myid AS myid, mytable.name AS name "
             "FROM mytable WHERE mytable.myid = :myid_1) anon_2 "
             "WHERE "
-            "ROWNUM <= [POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2] "
+            "ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) anon_1 "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2] "
             "FOR UPDATE OF anon_1.name NOWAIT",
             checkparams={"param_1": 10, "param_2": 50, "myid_1": 7},
         )
@@ -587,9 +591,10 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "mytable.bar AS bar, "
             "mytable.foo AS foo FROM mytable "
             "WHERE mytable.myid = :myid_1) anon_2 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) "
             "anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2] "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2] "
             "FOR UPDATE OF anon_1.foo, anon_1.bar NOWAIT",
             checkparams={"param_1": 10, "param_2": 50, "myid_1": 7},
         )
@@ -617,7 +622,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "SELECT anon_1.col1, anon_1.col2 FROM "
             "(SELECT sometable.col1 AS col1, "
             "sometable.col2 AS col2 FROM sometable) anon_1 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1]",
             dialect=dialect,
         )
 
@@ -635,7 +640,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "anon_2.col1 AS col1, anon_2.col2 AS col2, ROWNUM AS ora_rn "
             "FROM (SELECT sometable.col1 AS col1, sometable.col2 AS col2 "
             "FROM sometable) anon_2) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_1]",
+            "WHERE ora_rn > __[POSTCOMPILE_param_1]",
             dialect=dialect,
         )
 
@@ -653,9 +658,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "anon_2.col1 AS col1, anon_2.col2 AS col2, ROWNUM AS ora_rn "
             "FROM (SELECT sometable.col1 AS col1, sometable.col2 AS col2 "
             "FROM sometable) anon_2 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + "
-            "[POSTCOMPILE_param_2]) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) anon_1 "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2]",
             dialect=dialect,
         )
 
@@ -672,7 +677,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "SELECT anon_1.col1, anon_1.col2 FROM "
             "(SELECT sometable.col1 AS col1, "
             "sometable.col2 AS col2 FROM sometable) anon_1 WHERE ROWNUM "
-            "<= [POSTCOMPILE_param_1]",
+            "<= __[POSTCOMPILE_param_1]",
             dialect=dialect,
         )
 
@@ -691,7 +696,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "ROWNUM AS ora_rn "
             "FROM (SELECT sometable.col1 AS col1, sometable.col2 AS col2 "
             "FROM sometable) anon_2) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_1]",
+            "WHERE ora_rn > __[POSTCOMPILE_param_1]",
             dialect=dialect,
         )
 
@@ -710,9 +715,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "ROWNUM AS ora_rn "
             "FROM (SELECT sometable.col1 AS col1, sometable.col2 AS col2 "
             "FROM sometable) anon_2 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + "
-            "[POSTCOMPILE_param_2]) anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2]",
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) anon_1 "
+            "WHERE ora_rn > __[POSTCOMPILE_param_2]",
             dialect=dialect,
             checkparams={"param_1": 10, "param_2": 10},
         )
@@ -914,9 +919,10 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
             "thirdtable.userid(+) = "
             "myothertable.otherid AND mytable.myid = "
             "myothertable.otherid ORDER BY mytable.name) anon_2 "
-            "WHERE ROWNUM <= [POSTCOMPILE_param_1] + [POSTCOMPILE_param_2]) "
+            "WHERE ROWNUM <= __[POSTCOMPILE_param_1] + "
+            "__[POSTCOMPILE_param_2]) "
             "anon_1 "
-            "WHERE ora_rn > [POSTCOMPILE_param_2]",
+            "WHERE ora_rn > __[POSTCOMPILE_param_2]",
             checkparams={"param_1": 10, "param_2": 5},
             dialect=oracle.dialect(use_ansi=False),
         )
index ebb4d4b1257a5bdf5ffdd338777ea553981141f9..715ce6ba838ffaad803994afd61cf74318450da8 100644 (file)
@@ -1206,7 +1206,7 @@ class ArrayTest(AssertsCompiledSQL, fixtures.TestBase):
 
         self.assert_compile(
             expr,
-            "x IN ([POSTCOMPILE_x_1~~~~REPL~~::myenum[]~~])",
+            "x IN (__[POSTCOMPILE_x_1~~~~REPL~~::myenum[]~~])",
             dialect=postgresql.psycopg2.dialect(),
         )
 
@@ -1224,7 +1224,7 @@ class ArrayTest(AssertsCompiledSQL, fixtures.TestBase):
 
         self.assert_compile(
             expr,
-            "x IN ([POSTCOMPILE_x_1~~~~REPL~~::VARCHAR(15)[]~~])",
+            "x IN (__[POSTCOMPILE_x_1~~~~REPL~~::VARCHAR(15)[]~~])",
             dialect=postgresql.psycopg2.dialect(),
         )
 
index a2fe81a4baa30a748f6eb75864ee9f5f2b4cc870..f1efaf7a687c0462311f307b947bcb7c3346bbe2 100644 (file)
@@ -1156,7 +1156,7 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL):
             .in_([(1, 2), (3, 4)])
             .compile(dialect=sqlite.dialect())
         )
-        eq_(str(compiled), "(q, p) IN ([POSTCOMPILE_param_1])")
+        eq_(str(compiled), "(q, p) IN (__[POSTCOMPILE_param_1])")
         eq_(
             compiled._literal_execute_expanding_parameter(
                 "param_1",
index afe95ba82680ec3edac5ad57deec280ad4b06963..5f53f2876e6ae5c5bc27e97233418dbd83ee2292 100644 (file)
@@ -1226,12 +1226,12 @@ class SchemaTranslateTest(fixtures.TestBase, testing.AssertsExecutionResults):
             t1.drop(conn)
 
         asserter.assert_(
-            CompiledSQL("CREATE TABLE [SCHEMA__none].t1 (x INTEGER)"),
-            CompiledSQL("CREATE TABLE [SCHEMA_foo].t2 (x INTEGER)"),
-            CompiledSQL("CREATE TABLE [SCHEMA_bar].t3 (x INTEGER)"),
-            CompiledSQL("DROP TABLE [SCHEMA_bar].t3"),
-            CompiledSQL("DROP TABLE [SCHEMA_foo].t2"),
-            CompiledSQL("DROP TABLE [SCHEMA__none].t1"),
+            CompiledSQL("CREATE TABLE __[SCHEMA__none].t1 (x INTEGER)"),
+            CompiledSQL("CREATE TABLE __[SCHEMA_foo].t2 (x INTEGER)"),
+            CompiledSQL("CREATE TABLE __[SCHEMA_bar].t3 (x INTEGER)"),
+            CompiledSQL("DROP TABLE __[SCHEMA_bar].t3"),
+            CompiledSQL("DROP TABLE __[SCHEMA_foo].t2"),
+            CompiledSQL("DROP TABLE __[SCHEMA__none].t1"),
         )
 
     def test_ddl_hastable(self, plain_tables, connection):
@@ -1331,27 +1331,29 @@ class SchemaTranslateTest(fixtures.TestBase, testing.AssertsExecutionResults):
             conn.execute(t3.delete(), execution_options=execution_options)
 
         asserter.assert_(
-            CompiledSQL("INSERT INTO [SCHEMA__none].t1 (x) VALUES (:x)"),
-            CompiledSQL("INSERT INTO [SCHEMA_foo].t2 (x) VALUES (:x)"),
-            CompiledSQL("INSERT INTO [SCHEMA_bar].t3 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO __[SCHEMA__none].t1 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO __[SCHEMA_foo].t2 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO __[SCHEMA_bar].t3 (x) VALUES (:x)"),
             CompiledSQL(
-                "UPDATE [SCHEMA__none].t1 SET x=:x WHERE "
-                "[SCHEMA__none].t1.x = :x_1"
+                "UPDATE __[SCHEMA__none].t1 SET x=:x WHERE "
+                "__[SCHEMA__none].t1.x = :x_1"
             ),
             CompiledSQL(
-                "UPDATE [SCHEMA_foo].t2 SET x=:x WHERE "
-                "[SCHEMA_foo].t2.x = :x_1"
+                "UPDATE __[SCHEMA_foo].t2 SET x=:x WHERE "
+                "__[SCHEMA_foo].t2.x = :x_1"
             ),
             CompiledSQL(
-                "UPDATE [SCHEMA_bar].t3 SET x=:x WHERE "
-                "[SCHEMA_bar].t3.x = :x_1"
+                "UPDATE __[SCHEMA_bar].t3 SET x=:x WHERE "
+                "__[SCHEMA_bar].t3.x = :x_1"
             ),
-            CompiledSQL("SELECT [SCHEMA__none].t1.x FROM [SCHEMA__none].t1"),
-            CompiledSQL("SELECT [SCHEMA_foo].t2.x FROM [SCHEMA_foo].t2"),
-            CompiledSQL("SELECT [SCHEMA_bar].t3.x FROM [SCHEMA_bar].t3"),
-            CompiledSQL("DELETE FROM [SCHEMA__none].t1"),
-            CompiledSQL("DELETE FROM [SCHEMA_foo].t2"),
-            CompiledSQL("DELETE FROM [SCHEMA_bar].t3"),
+            CompiledSQL(
+                "SELECT __[SCHEMA__none].t1.x FROM __[SCHEMA__none].t1"
+            ),
+            CompiledSQL("SELECT __[SCHEMA_foo].t2.x FROM __[SCHEMA_foo].t2"),
+            CompiledSQL("SELECT __[SCHEMA_bar].t3.x FROM __[SCHEMA_bar].t3"),
+            CompiledSQL("DELETE FROM __[SCHEMA__none].t1"),
+            CompiledSQL("DELETE FROM __[SCHEMA_foo].t2"),
+            CompiledSQL("DELETE FROM __[SCHEMA_bar].t3"),
         )
 
     def test_crud(self, plain_tables, connection):
@@ -1389,27 +1391,29 @@ class SchemaTranslateTest(fixtures.TestBase, testing.AssertsExecutionResults):
             conn.execute(t3.delete())
 
         asserter.assert_(
-            CompiledSQL("INSERT INTO [SCHEMA__none].t1 (x) VALUES (:x)"),
-            CompiledSQL("INSERT INTO [SCHEMA_foo].t2 (x) VALUES (:x)"),
-            CompiledSQL("INSERT INTO [SCHEMA_bar].t3 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO __[SCHEMA__none].t1 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO __[SCHEMA_foo].t2 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO __[SCHEMA_bar].t3 (x) VALUES (:x)"),
+            CompiledSQL(
+                "UPDATE __[SCHEMA__none].t1 SET x=:x WHERE "
+                "__[SCHEMA__none].t1.x = :x_1"
+            ),
             CompiledSQL(
-                "UPDATE [SCHEMA__none].t1 SET x=:x WHERE "
-                "[SCHEMA__none].t1.x = :x_1"
+                "UPDATE __[SCHEMA_foo].t2 SET x=:x WHERE "
+                "__[SCHEMA_foo].t2.x = :x_1"
             ),
             CompiledSQL(
-                "UPDATE [SCHEMA_foo].t2 SET x=:x WHERE "
-                "[SCHEMA_foo].t2.x = :x_1"
+                "UPDATE __[SCHEMA_bar].t3 SET x=:x WHERE "
+                "__[SCHEMA_bar].t3.x = :x_1"
             ),
             CompiledSQL(
-                "UPDATE [SCHEMA_bar].t3 SET x=:x WHERE "
-                "[SCHEMA_bar].t3.x = :x_1"
+                "SELECT __[SCHEMA__none].t1.x FROM __[SCHEMA__none].t1"
             ),
-            CompiledSQL("SELECT [SCHEMA__none].t1.x FROM [SCHEMA__none].t1"),
-            CompiledSQL("SELECT [SCHEMA_foo].t2.x FROM [SCHEMA_foo].t2"),
-            CompiledSQL("SELECT [SCHEMA_bar].t3.x FROM [SCHEMA_bar].t3"),
-            CompiledSQL("DELETE FROM [SCHEMA__none].t1"),
-            CompiledSQL("DELETE FROM [SCHEMA_foo].t2"),
-            CompiledSQL("DELETE FROM [SCHEMA_bar].t3"),
+            CompiledSQL("SELECT __[SCHEMA_foo].t2.x FROM __[SCHEMA_foo].t2"),
+            CompiledSQL("SELECT __[SCHEMA_bar].t3.x FROM __[SCHEMA_bar].t3"),
+            CompiledSQL("DELETE FROM __[SCHEMA__none].t1"),
+            CompiledSQL("DELETE FROM __[SCHEMA_foo].t2"),
+            CompiledSQL("DELETE FROM __[SCHEMA_bar].t3"),
         )
 
     def test_via_engine(self, plain_tables, metadata):
@@ -1431,7 +1435,7 @@ class SchemaTranslateTest(fixtures.TestBase, testing.AssertsExecutionResults):
             with eng.connect() as conn:
                 conn.execute(select(t2.c.x))
         asserter.assert_(
-            CompiledSQL("SELECT [SCHEMA_foo].t2.x FROM [SCHEMA_foo].t2")
+            CompiledSQL("SELECT __[SCHEMA_foo].t2.x FROM __[SCHEMA_foo].t2")
         )
 
 
index 664c00630386ec19d2e5fa74e699a6099d59ad45..f3feb5ddf23ac637ba11f983017adf74b5e1bd3a 100644 (file)
@@ -1639,7 +1639,7 @@ class DeclarativeMixinPropertyTest(
         self.assert_compile(
             s.query(Derived.data_syn).filter(Derived.data_syn == "foo"),
             "SELECT test.data AS test_data FROM test WHERE test.data = "
-            ":data_1 AND test.type IN ([POSTCOMPILE_type_1])",
+            ":data_1 AND test.type IN (__[POSTCOMPILE_type_1])",
             dialect="default",
             checkparams={"type_1": ["derived"], "data_1": "foo"},
         )
index 8c807c1152ed1d172aac4b2714d8ccf3aadb9687..6f370d5e47db7ece5cf8fdd9599c9cc2c7210a12 100644 (file)
@@ -532,7 +532,7 @@ class RelationshipToSingleTest(
                 "companies.name AS companies_name FROM companies "
                 "LEFT OUTER JOIN employees AS employees_1 ON "
                 "companies.company_id = employees_1.company_id "
-                "AND employees_1.type IN ([POSTCOMPILE_type_1])",
+                "AND employees_1.type IN (__[POSTCOMPILE_type_1])",
             )
 
 
@@ -739,7 +739,7 @@ class SingleFromPolySelectableTest(
             "engineer.engineer_info AS engineer_engineer_info, "
             "engineer.manager_id AS engineer_manager_id "
             "FROM employee JOIN engineer ON employee.id = engineer.id) "
-            "AS anon_1 WHERE anon_1.employee_type IN ([POSTCOMPILE_type_1])",
+            "AS anon_1 WHERE anon_1.employee_type IN (__[POSTCOMPILE_type_1])",
         )
 
 
index 35822a29e9fb7773b705419ec3eb207bc24f90be..c18b21d99d86880aa3a79733d8b71c3f87b2defe 100644 (file)
@@ -110,7 +110,7 @@ class BaseAndSubFixture(object):
                         "a.type AS a_type, "
                         "asub.asubdata AS asub_asubdata FROM a JOIN asub "
                         "ON a.id = asub.id "
-                        "WHERE a.id IN ([POSTCOMPILE_primary_keys]) "
+                        "WHERE a.id IN (__[POSTCOMPILE_primary_keys]) "
                         "ORDER BY a.id",
                         {"primary_keys": [2]},
                     ),
@@ -123,13 +123,13 @@ class BaseAndSubFixture(object):
                         "SELECT c.a_sub_id AS c_a_sub_id, "
                         "c.id AS c_id "
                         "FROM c WHERE c.a_sub_id "
-                        "IN ([POSTCOMPILE_primary_keys])",
+                        "IN (__[POSTCOMPILE_primary_keys])",
                         {"primary_keys": [2]},
                     ),
                 ),
                 CompiledSQL(
                     "SELECT b.a_id AS b_a_id, b.id AS b_id FROM b "
-                    "WHERE b.a_id IN ([POSTCOMPILE_primary_keys])",
+                    "WHERE b.a_id IN (__[POSTCOMPILE_primary_keys])",
                     {"primary_keys": [1, 2]},
                 ),
             ),
@@ -209,7 +209,7 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                     "engineers.primary_language AS engineers_primary_language "
                     "FROM people JOIN engineers "
                     "ON people.person_id = engineers.person_id "
-                    "WHERE people.person_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE people.person_id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY people.person_id",
                     {"primary_keys": [1, 2, 5]},
                 ),
@@ -221,7 +221,7 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                     "managers.manager_name AS managers_manager_name "
                     "FROM people JOIN managers "
                     "ON people.person_id = managers.person_id "
-                    "WHERE people.person_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE people.person_id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY people.person_id",
                     {"primary_keys": [3, 4]},
                 ),
@@ -255,7 +255,7 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                 "people.person_id AS people_person_id, "
                 "people.name AS people_name, people.type AS people_type "
                 "FROM people WHERE people.company_id "
-                "IN ([POSTCOMPILE_primary_keys]) "
+                "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY people.person_id",
                 {"primary_keys": [1, 2]},
             ),
@@ -269,7 +269,7 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                     "managers.manager_name AS managers_manager_name "
                     "FROM people JOIN managers "
                     "ON people.person_id = managers.person_id "
-                    "WHERE people.person_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE people.person_id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY people.person_id",
                     {"primary_keys": [3, 4]},
                 ),
@@ -283,7 +283,7 @@ class FixtureLoadTest(_Polymorphic, testing.AssertsExecutionResults):
                     "engineers.primary_language AS engineers_primary_language "
                     "FROM people JOIN engineers "
                     "ON people.person_id = engineers.person_id "
-                    "WHERE people.person_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE people.person_id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY people.person_id",
                     {"primary_keys": [1, 2, 5]},
                 ),
@@ -338,7 +338,8 @@ class TestGeometries(GeometryFixtureBase):
                     "c.c_data AS c_c_data, c.e_data AS c_e_data, "
                     "c.d_data AS c_d_data "
                     "FROM a JOIN c ON a.id = c.id "
-                    "WHERE a.id IN ([POSTCOMPILE_primary_keys]) ORDER BY a.id",
+                    "WHERE a.id IN (__[POSTCOMPILE_primary_keys]) "
+                    "ORDER BY a.id",
                     [{"primary_keys": [1, 2]}],
                 ),
                 CompiledSQL(
@@ -346,7 +347,8 @@ class TestGeometries(GeometryFixtureBase):
                     "c.c_data AS c_c_data, "
                     "c.d_data AS c_d_data, c.e_data AS c_e_data "
                     "FROM a JOIN c ON a.id = c.id "
-                    "WHERE a.id IN ([POSTCOMPILE_primary_keys]) ORDER BY a.id",
+                    "WHERE a.id IN (__[POSTCOMPILE_primary_keys]) "
+                    "ORDER BY a.id",
                     [{"primary_keys": [1, 2]}],
                 ),
             ),
@@ -393,7 +395,8 @@ class TestGeometries(GeometryFixtureBase):
                     "c.c_data AS c_c_data, c.e_data AS c_e_data, "
                     "c.d_data AS c_d_data "
                     "FROM a JOIN c ON a.id = c.id "
-                    "WHERE a.id IN ([POSTCOMPILE_primary_keys]) ORDER BY a.id",
+                    "WHERE a.id IN (__[POSTCOMPILE_primary_keys]) "
+                    "ORDER BY a.id",
                     [{"primary_keys": [1, 2]}],
                 ),
                 CompiledSQL(
@@ -401,7 +404,8 @@ class TestGeometries(GeometryFixtureBase):
                     "c.c_data AS c_c_data, c.d_data AS c_d_data, "
                     "c.e_data AS c_e_data "
                     "FROM a JOIN c ON a.id = c.id "
-                    "WHERE a.id IN ([POSTCOMPILE_primary_keys]) ORDER BY a.id",
+                    "WHERE a.id IN (__[POSTCOMPILE_primary_keys]) "
+                    "ORDER BY a.id",
                     [{"primary_keys": [1, 2]}],
                 ),
             ),
@@ -469,7 +473,7 @@ class TestGeometries(GeometryFixtureBase):
                     "e.id AS e_id, e.e_data AS e_e_data FROM a JOIN c "
                     "ON a.id = c.id LEFT OUTER JOIN d ON c.id = d.id "
                     "LEFT OUTER JOIN e ON c.id = e.id) AS poly "
-                    "WHERE poly.a_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE poly.a_id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY poly.a_id",
                     [{"primary_keys": [1, 2]}],
                 ),
@@ -485,7 +489,7 @@ class TestGeometries(GeometryFixtureBase):
                     "e.e_data AS e_e_data FROM a JOIN c ON a.id = c.id "
                     "LEFT OUTER JOIN d ON c.id = d.id "
                     "LEFT OUTER JOIN e ON c.id = e.id) AS poly "
-                    "WHERE poly.a_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE poly.a_id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY poly.a_id",
                     [{"primary_keys": [1, 2]}],
                 ),
@@ -622,7 +626,7 @@ class LoaderOptionsTest(
                     "child.type AS child_type "
                     "FROM child JOIN child_subclass1 "
                     "ON child.id = child_subclass1.id "
-                    "WHERE child.id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE child.id IN (__[POSTCOMPILE_primary_keys]) "
                     "ORDER BY child.id",
                     [{"primary_keys": [1]}],
                 ),
@@ -672,7 +676,7 @@ class LoaderOptionsTest(
                 "ON child.id = child_subclass1.id "
                 "LEFT OUTER JOIN other AS other_1 "
                 "ON child_subclass1.id = other_1.child_subclass_id "
-                "WHERE child.id IN ([POSTCOMPILE_primary_keys]) "
+                "WHERE child.id IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY child.id",
                 [{"primary_keys": [1]}],
             ),
index eeb3a7ed6366a107c16753d4519494974efbe8b1..d12cb1999a0d0aeea52065a9ef1a82c2be46b762 100644 (file)
@@ -2190,7 +2190,7 @@ class ContainsEagerMultipleOfType(
             "a_b.kind AS a_b_kind, a_b.a_id AS a_b_a_id, a.id AS a_id_1, "
             "a.kind AS a_kind, a.a_id AS a_a_id FROM a "
             "LEFT OUTER JOIN a AS a_b ON a.id = a_b.a_id AND a_b.kind IN "
-            "([POSTCOMPILE_kind_1]) LEFT OUTER JOIN x AS b_x "
+            "(__[POSTCOMPILE_kind_1]) LEFT OUTER JOIN x AS b_x "
             "ON a_b.id = b_x.a_id",
         )
 
@@ -2383,7 +2383,7 @@ class JoinedloadOverWPolyAliased(
             joinedload(cls.links).joinedload(Link.child).joinedload(cls.links)
         )
         if cls is self.classes.Sub1:
-            extra = " WHERE parent.type IN ([POSTCOMPILE_type_1])"
+            extra = " WHERE parent.type IN (__[POSTCOMPILE_type_1])"
         else:
             extra = ""
 
@@ -2413,7 +2413,7 @@ class JoinedloadOverWPolyAliased(
         )
 
         if Link.child.property.mapper.class_ is self.classes.Sub1:
-            extra = "AND parent_1.type IN ([POSTCOMPILE_type_1]) "
+            extra = "AND parent_1.type IN (__[POSTCOMPILE_type_1]) "
         else:
             extra = ""
 
index 30d4549c41bd2cf2a2d3d23d33c931c40a71c172..fbafdd85be758267591558693f05f08f11972b4e 100644 (file)
@@ -182,9 +182,9 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
         self.assert_compile(
             select(subq1, subq2),
             "SELECT (SELECT employees.employee_id FROM employees "
-            "WHERE employees.type IN ([POSTCOMPILE_type_1])) AS foo, "
+            "WHERE employees.type IN (__[POSTCOMPILE_type_1])) AS foo, "
             "(SELECT employees.employee_id FROM employees "
-            "WHERE employees.type IN ([POSTCOMPILE_type_1])) AS bar",
+            "WHERE employees.type IN (__[POSTCOMPILE_type_1])) AS bar",
         )
 
     def test_multi_qualification(self):
@@ -329,7 +329,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
                 "employees.engineer_info AS "
                 "employees_engineer_info, employees.type "
                 "AS employees_type FROM employees WHERE "
-                "employees.type IN ([POSTCOMPILE_type_1])) AS "
+                "employees.type IN (__[POSTCOMPILE_type_1])) AS "
                 "anon_1",
                 use_default_dialect=True,
             )
@@ -370,8 +370,8 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             "employees.engineer_info AS "
             "employees_engineer_info, employees.type "
             "AS employees_type FROM employees WHERE "
-            "employees.type IN ([POSTCOMPILE_type_1])) AS "
-            "anon_1 WHERE anon_1.employees_type IN ([POSTCOMPILE_type_2])",
+            "employees.type IN (__[POSTCOMPILE_type_1])) AS "
+            "anon_1 WHERE anon_1.employees_type IN (__[POSTCOMPILE_type_2])",
             use_default_dialect=True,
         )
 
@@ -385,13 +385,13 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             sess.query(a1.employee_id).select_from(a1),
             "SELECT employees_1.employee_id AS employees_1_employee_id "
             "FROM employees AS employees_1 WHERE employees_1.type "
-            "IN ([POSTCOMPILE_type_1])",
+            "IN (__[POSTCOMPILE_type_1])",
         )
 
         self.assert_compile(
             sess.query(literal("1")).select_from(a1),
             "SELECT :param_1 AS anon_1 FROM employees AS employees_1 "
-            "WHERE employees_1.type IN ([POSTCOMPILE_type_1])",
+            "WHERE employees_1.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_from_statement_select(self):
@@ -406,7 +406,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             "SELECT employees.employee_id, employees.name, "
             "employees.manager_data, employees.engineer_info, "
             "employees.type FROM employees WHERE employees.type "
-            "IN ([POSTCOMPILE_type_1])",
+            "IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_from_statement_update(self):
@@ -427,7 +427,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
         self.assert_compile(
             q,
             "UPDATE employees SET engineer_info=:engineer_info "
-            "WHERE employees.type IN ([POSTCOMPILE_type_1]) "
+            "WHERE employees.type IN (__[POSTCOMPILE_type_1]) "
             "RETURNING employees.employee_id",
             dialect="default_enhanced",
         )
@@ -452,7 +452,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             "employees.engineer_info AS employees_engineer_info, "
             "employees.type AS employees_type FROM employees "
             "WHERE employees.engineer_info = :engineer_info_1 "
-            "AND employees.type IN ([POSTCOMPILE_type_1]) "
+            "AND employees.type IN (__[POSTCOMPILE_type_1]) "
             "%(token)s "
             "SELECT employees.employee_id AS employees_employee_id, "
             "employees.name AS employees_name, "
@@ -460,7 +460,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             "employees.engineer_info AS employees_engineer_info, "
             "employees.type AS employees_type FROM employees "
             "WHERE employees.manager_data = :manager_data_1 "
-            "AND employees.type IN ([POSTCOMPILE_type_2])) AS anon_1"
+            "AND employees.type IN (__[POSTCOMPILE_type_2])) AS anon_1"
         )
 
         for meth, token in [
@@ -496,7 +496,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             "employees.name AS employees_name, employees.manager_data "
             "AS employees_manager_data, employees.engineer_info "
             "AS employees_engineer_info, employees.type AS employees_type "
-            "FROM employees WHERE employees.type IN ([POSTCOMPILE_type_1]) "
+            "FROM employees WHERE employees.type IN (__[POSTCOMPILE_type_1]) "
             "GROUP BY employees.employee_id HAVING employees.name = :name_1",
         )
 
@@ -511,7 +511,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
                 "SELECT count(*) AS count_1 "
                 "FROM (SELECT employees.employee_id AS employees_employee_id "
                 "FROM employees "
-                "WHERE employees.type IN ([POSTCOMPILE_type_1])) AS anon_1",
+                "WHERE employees.type IN (__[POSTCOMPILE_type_1])) AS anon_1",
                 use_default_dialect=True,
             )
 
@@ -649,7 +649,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
             ),
             "SELECT EXISTS (SELECT 1 FROM employees WHERE "
             "employees.name = :name_1 AND employees.type "
-            "IN ([POSTCOMPILE_type_1])) AS anon_1",
+            "IN (__[POSTCOMPILE_type_1])) AS anon_1",
         )
 
     def test_type_filtering(self):
@@ -783,7 +783,8 @@ class RelationshipFromSingleTest(
             CompiledSQL(
                 "SELECT employee.id AS employee_id, employee.name AS "
                 "employee_name, employee.type AS employee_type "
-                "FROM employee WHERE employee.type IN ([POSTCOMPILE_type_1])",
+                "FROM employee WHERE employee.type IN "
+                "(__[POSTCOMPILE_type_1])",
                 params=[{"type_1": ["manager"]}],
             ),
             CompiledSQL(
@@ -794,7 +795,7 @@ class RelationshipFromSingleTest(
                 "employee_stuff_name, anon_1.employee_id "
                 "AS anon_1_employee_id FROM (SELECT "
                 "employee.id AS employee_id FROM employee "
-                "WHERE employee.type IN ([POSTCOMPILE_type_1])) AS anon_1 "
+                "WHERE employee.type IN (__[POSTCOMPILE_type_1])) AS anon_1 "
                 "JOIN employee_stuff ON anon_1.employee_id "
                 "= employee_stuff.employee_id",
                 params=[{"type_1": ["manager"]}],
@@ -979,7 +980,7 @@ class RelationshipToSingleTest(
             "employees.name AS employees_name "
             "FROM companies LEFT OUTER JOIN employees ON companies.company_id "
             "= employees.company_id "
-            "AND employees.type IN ([POSTCOMPILE_type_1])",
+            "AND employees.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_outer_join_prop_alias(self):
@@ -1013,7 +1014,7 @@ class RelationshipToSingleTest(
             "employees_1_name FROM companies LEFT OUTER "
             "JOIN employees AS employees_1 ON companies.company_id "
             "= employees_1.company_id "
-            "AND employees_1.type IN ([POSTCOMPILE_type_1])",
+            "AND employees_1.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_outer_join_literal_onclause(self):
@@ -1051,7 +1052,7 @@ class RelationshipToSingleTest(
             "employees.company_id AS employees_company_id FROM companies "
             "LEFT OUTER JOIN employees ON "
             "companies.company_id = employees.company_id "
-            "AND employees.type IN ([POSTCOMPILE_type_1])",
+            "AND employees.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_outer_join_literal_onclause_alias(self):
@@ -1090,7 +1091,7 @@ class RelationshipToSingleTest(
             "employees_1.company_id AS employees_1_company_id "
             "FROM companies LEFT OUTER JOIN employees AS employees_1 ON "
             "companies.company_id = employees_1.company_id "
-            "AND employees_1.type IN ([POSTCOMPILE_type_1])",
+            "AND employees_1.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_outer_join_no_onclause(self):
@@ -1126,7 +1127,7 @@ class RelationshipToSingleTest(
             "employees.company_id AS employees_company_id "
             "FROM companies LEFT OUTER JOIN employees ON "
             "companies.company_id = employees.company_id "
-            "AND employees.type IN ([POSTCOMPILE_type_1])",
+            "AND employees.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_outer_join_no_onclause_alias(self):
@@ -1163,7 +1164,7 @@ class RelationshipToSingleTest(
             "employees_1.company_id AS employees_1_company_id "
             "FROM companies LEFT OUTER JOIN employees AS employees_1 ON "
             "companies.company_id = employees_1.company_id "
-            "AND employees_1.type IN ([POSTCOMPILE_type_1])",
+            "AND employees_1.type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_correlated_column_select(self):
@@ -1200,7 +1201,7 @@ class RelationshipToSingleTest(
             "(SELECT count(employees.employee_id) AS count_1 "
             "FROM employees WHERE employees.company_id = "
             "companies.company_id "
-            "AND employees.type IN ([POSTCOMPILE_type_1])) AS anon_1 "
+            "AND employees.type IN (__[POSTCOMPILE_type_1])) AS anon_1 "
             "FROM companies",
         )
 
@@ -1282,8 +1283,8 @@ class RelationshipToSingleTest(
                 "ON companies.company_id = employees.company_id "
                 "JOIN employees "
                 "ON companies.company_id = employees.company_id "
-                "AND employees.type IN ([POSTCOMPILE_type_1]) "
-                "WHERE employees.type IN ([POSTCOMPILE_type_2])",
+                "AND employees.type IN (__[POSTCOMPILE_type_1]) "
+                "WHERE employees.type IN (__[POSTCOMPILE_type_2])",
             )
 
     def test_relationship_to_subclass(self):
@@ -1554,7 +1555,7 @@ class ManyToManyToSingleTest(fixtures.MappedTest, AssertsCompiledSQL):
             "child.name AS child_name "
             "FROM parent LEFT OUTER JOIN (m2m AS m2m_1 "
             "JOIN child ON child.id = m2m_1.child_id "
-            "AND child.discriminator IN ([POSTCOMPILE_discriminator_1])) "
+            "AND child.discriminator IN (__[POSTCOMPILE_discriminator_1])) "
             "ON parent.id = m2m_1.parent_id",
         )
 
@@ -1571,7 +1572,7 @@ class ManyToManyToSingleTest(fixtures.MappedTest, AssertsCompiledSQL):
             "FROM parent LEFT OUTER JOIN "
             "(m2m AS m2m_1 JOIN child AS child_1 "
             "ON child_1.id = m2m_1.child_id AND child_1.discriminator "
-            "IN ([POSTCOMPILE_discriminator_1])) "
+            "IN (__[POSTCOMPILE_discriminator_1])) "
             "ON parent.id = m2m_1.parent_id",
         )
 
@@ -1780,7 +1781,7 @@ class SingleFromPolySelectableTest(
             "engineer.manager_id AS engineer_manager_id "
             "FROM employee JOIN engineer ON employee.id = engineer.id) "
             "AS anon_1 "
-            "WHERE anon_1.employee_type IN ([POSTCOMPILE_type_1])",
+            "WHERE anon_1.employee_type IN (__[POSTCOMPILE_type_1])",
         )
 
     def test_query_wpoly_single_inh_subclass(self):
@@ -1809,7 +1810,7 @@ class SingleFromPolySelectableTest(
             "engineer.engineer_info AS engineer_engineer_info, "
             "engineer.manager_id AS engineer_manager_id "
             "FROM employee JOIN engineer ON employee.id = engineer.id) "
-            "AS anon_1 WHERE anon_1.employee_type IN ([POSTCOMPILE_type_1])",
+            "AS anon_1 WHERE anon_1.employee_type IN (__[POSTCOMPILE_type_1])",
         )
 
     @testing.combinations((True,), (False,), argnames="autoalias")
@@ -1836,7 +1837,7 @@ class SingleFromPolySelectableTest(
                 "JOIN (employee AS employee_1 JOIN engineer AS engineer_1 "
                 "ON employee_1.id = engineer_1.id) "
                 "ON engineer_1.manager_id = manager.id "
-                "WHERE employee.type IN ([POSTCOMPILE_type_1])",
+                "WHERE employee.type IN (__[POSTCOMPILE_type_1])",
             )
 
     def test_single_inh_subclass_join_wpoly_joined_inh_subclass(self):
@@ -1873,7 +1874,7 @@ class SingleFromPolySelectableTest(
             "FROM employee "
             "JOIN engineer ON employee.id = engineer.id) AS anon_1 "
             "ON anon_1.manager_id = manager.id "
-            "WHERE employee.type IN ([POSTCOMPILE_type_1])",
+            "WHERE employee.type IN (__[POSTCOMPILE_type_1])",
         )
 
     @testing.combinations((True,), (False,), argnames="autoalias")
@@ -1903,7 +1904,7 @@ class SingleFromPolySelectableTest(
                 "JOIN (employee AS employee_1 JOIN manager AS manager_1 "
                 "ON employee_1.id = manager_1.id) "
                 "ON engineer.manager_id = manager_1.id "
-                "AND employee_1.type IN ([POSTCOMPILE_type_1])",
+                "AND employee_1.type IN (__[POSTCOMPILE_type_1])",
             )
 
 
index 6a050b698c68511e7f208e29fa2de40ad156890d..f59d704f3f218cce06353f1358dbaa3cb75c8513 100644 (file)
@@ -315,7 +315,7 @@ class AltSelectableTest(
                 "SELECT a_1.id AS a_1_id, b.id AS b_id FROM a AS a_1 "
                 "JOIN (b JOIN d ON d.b_id = b.id JOIN c ON c.id = d.c_id) "
                 "ON a_1.b_id = b.id WHERE a_1.id "
-                "IN ([POSTCOMPILE_primary_keys])",
+                "IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1]}],
             ),
         )
index bfdfb00b7fd12761f6746de447b0f1996f950ad2..b14313e8bac338dce9ac00b043edaf197786ee8e 100644 (file)
@@ -1167,7 +1167,7 @@ class DeferredOptionsTest(AssertsCompiledSQL, _fixtures.FixtureTest):
         expected = [
             (
                 "SELECT users.id AS users_id, users.name AS users_name "
-                "FROM users WHERE users.id IN ([POSTCOMPILE_id_1])",
+                "FROM users WHERE users.id IN (__[POSTCOMPILE_id_1])",
                 {"id_1": [7, 8]},
             ),
             (
index 061cad7e3b7260d43cc8a86a1005c4748d1200dd..5fd876474c554939d46614ca767622cd281d2069 100644 (file)
@@ -7282,7 +7282,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             lambda users: users.select().where(users.c.id.in_([7, 8])),
             "SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name "
             "FROM (SELECT users.id AS id, users.name AS name "
-            "FROM users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "FROM users WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "WHERE anon_1.name = :name_1",
         ),
         (
@@ -7292,14 +7292,14 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             "SELECT anon_1.users_id AS anon_1_users_id, anon_1.users_name "
             "AS anon_1_users_name FROM (SELECT users.id AS users_id, "
             "users.name AS users_name FROM users "
-            "WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "WHERE anon_1.users_name = :name_1",
         ),
         (
             lambda User, sess: sess.query(User).where(User.id.in_([7, 8])),
             "SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name "
             "FROM (SELECT users.id AS id, users.name AS name "
-            "FROM users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "FROM users WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "WHERE anon_1.name = :name_1",
         ),
     )
@@ -7813,7 +7813,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
                 "users_1.name AS users_1_name "
                 "FROM users AS users_1, ("
                 "SELECT users.id AS id, users.name AS name FROM users "
-                "WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+                "WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
                 "WHERE users_1.id > anon_1.id",
                 check_post_param={"id_1": [7, 8]},
             )
@@ -7826,7 +7826,8 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
                 "SELECT users_1.id AS users_1_id, "
                 "users_1.name AS users_1_name "
                 "FROM (SELECT users.id AS id, users.name AS name "
-                "FROM users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+                "FROM users WHERE users.id IN "
+                "(__[POSTCOMPILE_id_1])) AS anon_1 "
                 "JOIN users AS users_1 ON users_1.id > anon_1.id",
                 check_post_param={"id_1": [7, 8]},
             )
@@ -7839,7 +7840,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
                 "SELECT users_1.id AS users_1_id, "
                 "users_1.name AS users_1_name "
                 "FROM (SELECT users.id AS id, users.name AS name FROM "
-                "users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+                "users WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
                 "JOIN users AS users_1 ON users_1.id > anon_1.id",
                 check_post_param={"id_1": [7, 8]},
             )
@@ -7854,7 +7855,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
                 "FROM "
                 "(SELECT users.id AS id, users.name AS name "
                 "FROM users WHERE users.id "
-                "IN ([POSTCOMPILE_id_1])) AS anon_1 "
+                "IN (__[POSTCOMPILE_id_1])) AS anon_1 "
                 "JOIN users AS users_1 ON users_1.id > anon_1.id",
                 check_post_param={"id_1": [7, 8]},
             )
index af3dd8a60f345180510d7894b15f21b10e08bc6f..6e1c94e12f596243afdfc8c968c0347bf2c72d2c 100644 (file)
@@ -2779,7 +2779,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             sess.query(User).join(sel, User.id > sel.c.id),
             "SELECT users.id AS users_id, users.name AS users_name FROM "
             "users JOIN (SELECT users.id AS id, users.name AS name FROM users "
-            "WHERE users.id IN ([POSTCOMPILE_id_1])) "
+            "WHERE users.id IN (__[POSTCOMPILE_id_1])) "
             "AS anon_1 ON users.id > anon_1.id",
         )
 
@@ -2788,7 +2788,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             "SELECT users_1.id AS users_1_id, users_1.name AS users_1_name "
             "FROM users AS users_1, ("
             "SELECT users.id AS id, users.name AS name FROM users "
-            "WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "WHERE users_1.id > anon_1.id",
             check_post_param={"id_1": [7, 8]},
         )
@@ -2797,7 +2797,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             sess.query(ualias).select_from(ua).join(ualias, ualias.id > ua.id),
             "SELECT users_1.id AS users_1_id, users_1.name AS users_1_name "
             "FROM (SELECT users.id AS id, users.name AS name "
-            "FROM users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "FROM users WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "JOIN users AS users_1 ON users_1.id > anon_1.id",
             check_post_param={"id_1": [7, 8]},
         )
@@ -2806,7 +2806,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             sess.query(ualias).select_from(ua).join(ualias, ualias.id > ua.id),
             "SELECT users_1.id AS users_1_id, users_1.name AS users_1_name "
             "FROM (SELECT users.id AS id, users.name AS name FROM "
-            "users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "users WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "JOIN users AS users_1 ON users_1.id > anon_1.id",
             check_post_param={"id_1": [7, 8]},
         )
@@ -2816,7 +2816,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
             sess.query(salias).join(ualias, ualias.id > salias.id),
             "SELECT anon_1.id AS anon_1_id, anon_1.name AS anon_1_name FROM "
             "(SELECT users.id AS id, users.name AS name "
-            "FROM users WHERE users.id IN ([POSTCOMPILE_id_1])) AS anon_1 "
+            "FROM users WHERE users.id IN (__[POSTCOMPILE_id_1])) AS anon_1 "
             "JOIN users AS users_1 ON users_1.id > anon_1.id",
             check_post_param={"id_1": [7, 8]},
         )
index e073754848ec9a00fa4e5a77f87e881757aa4b70..b296f22409dc49d4011ac2118c90ebf81a610086 100644 (file)
@@ -345,7 +345,8 @@ class CompileTest(_fixtures.FixtureTest, AssertsCompiledSQL):
             "FROM (SELECT anon_2.users_id AS users_id, "
             "anon_2.users_name AS users_name FROM "
             "(SELECT users.id AS users_id, users.name AS users_name "
-            "FROM users) anon_2 WHERE ROWNUM <= [POSTCOMPILE_param_1]) anon_1 "
+            "FROM users) anon_2 WHERE ROWNUM <= "
+            "__[POSTCOMPILE_param_1]) anon_1 "
             "LEFT OUTER JOIN addresses addresses_1 "
             "ON anon_1.users_id = addresses_1.user_id FOR UPDATE",
             dialect="oracle",
index bdf7ab85923164eb7c3c09148f9c6aa2f811ac04..09b3cf51c00be3a5c245921d72130a0281e6867f 100644 (file)
@@ -1151,10 +1151,10 @@ class SubclassRelationshipTest3(
         "c.id AS c_id, c.type AS c_type, c.b_id AS c_b_id, a.id AS a_id, "
         "a.type AS a_type "
         "FROM a LEFT OUTER JOIN b ON "
-        "a.id = b.a_id AND b.type IN ([POSTCOMPILE_type_1]) "
+        "a.id = b.a_id AND b.type IN (__[POSTCOMPILE_type_1]) "
         "LEFT OUTER JOIN c ON "
-        "b.id = c.b_id AND c.type IN ([POSTCOMPILE_type_2]) "
-        "WHERE a.type IN ([POSTCOMPILE_type_3])"
+        "b.id = c.b_id AND c.type IN (__[POSTCOMPILE_type_2]) "
+        "WHERE a.type IN (__[POSTCOMPILE_type_3])"
     )
 
     _query2 = (
@@ -1162,10 +1162,10 @@ class SubclassRelationshipTest3(
         "ccc.id AS ccc_id, ccc.type AS ccc_type, ccc.b_id AS ccc_b_id, "
         "aaa.id AS aaa_id, aaa.type AS aaa_type "
         "FROM a AS aaa LEFT OUTER JOIN b AS bbb "
-        "ON aaa.id = bbb.a_id AND bbb.type IN ([POSTCOMPILE_type_1]) "
+        "ON aaa.id = bbb.a_id AND bbb.type IN (__[POSTCOMPILE_type_1]) "
         "LEFT OUTER JOIN c AS ccc ON "
-        "bbb.id = ccc.b_id AND ccc.type IN ([POSTCOMPILE_type_2]) "
-        "WHERE aaa.type IN ([POSTCOMPILE_type_3])"
+        "bbb.id = ccc.b_id AND ccc.type IN (__[POSTCOMPILE_type_2]) "
+        "WHERE aaa.type IN (__[POSTCOMPILE_type_3])"
     )
 
     _query3 = (
@@ -1173,10 +1173,10 @@ class SubclassRelationshipTest3(
         "c.id AS c_id, c.type AS c_type, c.b_id AS c_b_id, "
         "aaa.id AS aaa_id, aaa.type AS aaa_type "
         "FROM a AS aaa LEFT OUTER JOIN b AS bbb "
-        "ON aaa.id = bbb.a_id AND bbb.type IN ([POSTCOMPILE_type_1]) "
+        "ON aaa.id = bbb.a_id AND bbb.type IN (__[POSTCOMPILE_type_1]) "
         "LEFT OUTER JOIN c ON "
-        "bbb.id = c.b_id AND c.type IN ([POSTCOMPILE_type_2]) "
-        "WHERE aaa.type IN ([POSTCOMPILE_type_3])"
+        "bbb.id = c.b_id AND c.type IN (__[POSTCOMPILE_type_2]) "
+        "WHERE aaa.type IN (__[POSTCOMPILE_type_3])"
     )
 
     def _test(self, join_of_type, of_type_for_c1, aliased_):
index 98be71f34a390fd13e30e1db17ede1cfbd023074..5c17cdaefb99950dbd8be41315c5696af4096ae3 100644 (file)
@@ -2043,7 +2043,9 @@ class OperatorTest(QueryTest, AssertsCompiledSQL):
     def test_in(self):
         User = self.classes.User
 
-        self._test(User.id.in_(["a", "b"]), "users.id IN ([POSTCOMPILE_id_1])")
+        self._test(
+            User.id.in_(["a", "b"]), "users.id IN (__[POSTCOMPILE_id_1])"
+        )
 
     def test_in_on_relationship_not_supported(self):
         User, Address = self.classes.User, self.classes.Address
index 86f7e9fc91983ddc6a962bfc1ea37e8e6ffe2cbd..7e2c6e04f9fe07fa2552ec882e19004711880994 100644 (file)
@@ -367,7 +367,7 @@ class LoaderCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                 "SELECT addresses.user_id AS addresses_user_id, addresses.id "
                 "AS addresses_id, addresses.email_address "
                 "AS addresses_email_address FROM addresses "
-                "WHERE addresses.user_id IN ([POSTCOMPILE_primary_keys]) "
+                "WHERE addresses.user_id IN (__[POSTCOMPILE_primary_keys]) "
                 "AND addresses.email_address != :email_address_1 "
                 "ORDER BY addresses.id",
                 [{"primary_keys": [7, 8, 9, 10], "email_address_1": "name"}],
@@ -1227,7 +1227,8 @@ class RelationshipCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                     "SELECT addresses.user_id AS addresses_user_id, "
                     "addresses.id AS addresses_id, addresses.email_address "
                     "AS addresses_email_address FROM addresses "
-                    "WHERE addresses.user_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE addresses.user_id IN "
+                    "(__[POSTCOMPILE_primary_keys]) "
                     "AND addresses.email_address != :email_address_1 "
                     "ORDER BY addresses.id",
                     [
@@ -1304,7 +1305,7 @@ class RelationshipCriteriaTest(_Fixtures, testing.AssertsCompiledSQL):
                     "ON items_1.id = order_items_1.item_id "
                     "AND items_1.description = :description_1) "
                     "ON orders.id = order_items_1.order_id "
-                    "WHERE orders.user_id IN ([POSTCOMPILE_primary_keys]) "
+                    "WHERE orders.user_id IN (__[POSTCOMPILE_primary_keys]) "
                     "AND orders.description = :description_2 "
                     "ORDER BY orders.id, items_1.id",
                     [
index 94b30f3d01a0cf29d00d85adf93873c900c43043..98de9abad7378e95a029561792cc2c437ad1a73e 100644 (file)
@@ -6513,7 +6513,7 @@ class SecondaryIncludesLocalColsTest(fixtures.MappedTest):
                 "(SELECT a.id AS aid, b.id AS id FROM a JOIN b ON a.b_ids "
                 "LIKE :id_1 || b.id || :param_1) AS anon_1 "
                 "ON a_1.id = anon_1.aid JOIN b ON b.id = anon_1.id "
-                "WHERE a_1.id IN ([POSTCOMPILE_primary_keys])",
+                "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 params=[{"id_1": "%", "param_1": "%", "primary_keys": [2]}],
             ),
         )
index f01060aab503e7a2b6d8fb5e8c1c9d76852d18b7..2add1015ffc166fa2dd73e1500f5b1e8217cf93c 100644 (file)
@@ -1840,7 +1840,7 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "paperwork.paperwork_id AS paperwork_paperwork_id, "
                 "paperwork.description AS paperwork_description "
                 "FROM paperwork WHERE paperwork.person_id "
-                "IN ([POSTCOMPILE_primary_keys]) "
+                "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
                 [{"primary_keys": [1]}],
             ),
@@ -1890,7 +1890,7 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "paperwork.paperwork_id AS paperwork_paperwork_id, "
                 "paperwork.description AS paperwork_description "
                 "FROM paperwork WHERE paperwork.person_id "
-                "IN ([POSTCOMPILE_primary_keys]) "
+                "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
                 [{"primary_keys": [1]}],
             ),
@@ -1936,7 +1936,7 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "paperwork.paperwork_id AS paperwork_paperwork_id, "
                 "paperwork.description AS paperwork_description "
                 "FROM paperwork WHERE paperwork.person_id "
-                "IN ([POSTCOMPILE_primary_keys]) "
+                "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
                 [{"primary_keys": [1]}],
             ),
@@ -1990,7 +1990,7 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "paperwork.paperwork_id AS paperwork_paperwork_id, "
                 "paperwork.description AS paperwork_description "
                 "FROM paperwork WHERE paperwork.person_id "
-                "IN ([POSTCOMPILE_primary_keys]) "
+                "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
                 [{"primary_keys": [1]}],
             ),
@@ -2038,7 +2038,7 @@ class BaseRelationFromJoinedSubclassTest(_Polymorphic):
                 "paperwork.paperwork_id AS paperwork_paperwork_id, "
                 "paperwork.description AS paperwork_description "
                 "FROM paperwork WHERE paperwork.person_id "
-                "IN ([POSTCOMPILE_primary_keys]) "
+                "IN (__[POSTCOMPILE_primary_keys]) "
                 "ORDER BY paperwork.paperwork_id",
                 [{"primary_keys": [1]}],
             ),
@@ -2259,7 +2259,7 @@ class TupleTest(fixtures.DeclarativeMappedTest):
             CompiledSQL(
                 "SELECT b.a_id1 AS b_a_id1, b.a_id2 AS b_a_id2, b.id AS b_id "
                 "FROM b WHERE (b.a_id1, b.a_id2) IN "
-                "([POSTCOMPILE_primary_keys]) ORDER BY b.id",
+                "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 [{"primary_keys": [(i, i + 2) for i in range(1, 20)]}],
             ),
         )
@@ -2290,7 +2290,7 @@ class TupleTest(fixtures.DeclarativeMappedTest):
             ),
             CompiledSQL(
                 "SELECT a.id1 AS a_id1, a.id2 AS a_id2 FROM a "
-                "WHERE (a.id1, a.id2) IN ([POSTCOMPILE_primary_keys])",
+                "WHERE (a.id1, a.id2) IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [(i, i + 2) for i in range(1, 20)]}],
             ),
         )
@@ -2364,19 +2364,19 @@ class ChunkingTest(fixtures.DeclarativeMappedTest):
             CompiledSQL(
                 "SELECT b.a_id AS b_a_id, b.id AS b_id "
                 "FROM b WHERE b.a_id IN "
-                "([POSTCOMPILE_primary_keys]) ORDER BY b.id",
+                "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 {"primary_keys": list(range(1, 48))},
             ),
             CompiledSQL(
                 "SELECT b.a_id AS b_a_id, b.id AS b_id "
                 "FROM b WHERE b.a_id IN "
-                "([POSTCOMPILE_primary_keys]) ORDER BY b.id",
+                "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 {"primary_keys": list(range(48, 95))},
             ),
             CompiledSQL(
                 "SELECT b.a_id AS b_a_id, b.id AS b_id "
                 "FROM b WHERE b.a_id IN "
-                "([POSTCOMPILE_primary_keys]) ORDER BY b.id",
+                "(__[POSTCOMPILE_primary_keys]) ORDER BY b.id",
                 {"primary_keys": list(range(95, 101))},
             ),
         )
@@ -2440,19 +2440,19 @@ class ChunkingTest(fixtures.DeclarativeMappedTest):
             # chunk size is 47.  so first chunk are a 1->47...
             CompiledSQL(
                 "SELECT a.id AS a_id FROM a WHERE a.id IN "
-                "([POSTCOMPILE_primary_keys])",
+                "(__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": list(range(1, 48))},
             ),
             # second chunk is a 48-94
             CompiledSQL(
                 "SELECT a.id AS a_id FROM a WHERE a.id IN "
-                "([POSTCOMPILE_primary_keys])",
+                "(__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": list(range(48, 95))},
             ),
             # third and final chunk 95-100.
             CompiledSQL(
                 "SELECT a.id AS a_id FROM a WHERE a.id IN "
-                "([POSTCOMPILE_primary_keys])",
+                "(__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": list(range(95, 101))},
             ),
         )
@@ -2983,13 +2983,13 @@ class SelfRefInheritanceAliasedTest(
                     "SELECT foo_1.id AS foo_1_id, "
                     "foo_1.type AS foo_1_type, foo_1.foo_id AS foo_1_foo_id "
                     "FROM foo AS foo_1 "
-                    "WHERE foo_1.id IN ([POSTCOMPILE_primary_keys])",
+                    "WHERE foo_1.id IN (__[POSTCOMPILE_primary_keys])",
                     {"primary_keys": [3]},
                 ),
                 CompiledSQL(
                     "SELECT foo.id AS foo_id_1, foo.type AS foo_type, "
                     "foo.foo_id AS foo_foo_id FROM foo "
-                    "WHERE foo.id IN ([POSTCOMPILE_primary_keys])",
+                    "WHERE foo.id IN (__[POSTCOMPILE_primary_keys])",
                     {"primary_keys": [1]},
                 ),
             )
@@ -3153,13 +3153,13 @@ class SingleInhSubclassTest(
             q.all,
             CompiledSQL(
                 'SELECT "user".id AS user_id, "user".type AS user_type '
-                'FROM "user" WHERE "user".type IN ([POSTCOMPILE_type_1])',
+                'FROM "user" WHERE "user".type IN (__[POSTCOMPILE_type_1])',
                 {"type_1": ["employer"]},
             ),
             CompiledSQL(
                 "SELECT role.user_id AS role_user_id, role.id AS role_id "
                 "FROM role WHERE role.user_id "
-                "IN ([POSTCOMPILE_primary_keys])",
+                "IN (__[POSTCOMPILE_primary_keys])",
                 {"primary_keys": [1]},
             ),
         )
@@ -3277,12 +3277,12 @@ class M2OWDegradeTest(
             q.all,
             CompiledSQL(
                 "SELECT a.id AS a_id, a.b_id AS a_b_id, a.q AS a_q "
-                "FROM a WHERE a.id IN ([POSTCOMPILE_id_1]) ORDER BY a.id",
+                "FROM a WHERE a.id IN (__[POSTCOMPILE_id_1]) ORDER BY a.id",
                 [{"id_1": [1, 3]}],
             ),
             CompiledSQL(
                 "SELECT b.id AS b_id, b.x AS b_x, b.y AS b_y "
-                "FROM b WHERE b.id IN ([POSTCOMPILE_primary_keys])",
+                "FROM b WHERE b.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2]}],
             ),
         )
@@ -3306,7 +3306,7 @@ class M2OWDegradeTest(
             q.all,
             CompiledSQL(
                 "SELECT a.id AS a_id, a.q AS a_q "
-                "FROM a WHERE a.id IN ([POSTCOMPILE_id_1]) ORDER BY a.id",
+                "FROM a WHERE a.id IN (__[POSTCOMPILE_id_1]) ORDER BY a.id",
                 [{"id_1": [1, 3]}],
             ),
             # in the very unlikely case that the the FK col on parent is
@@ -3317,7 +3317,7 @@ class M2OWDegradeTest(
                 "SELECT a_1.id AS a_1_id, b.id AS b_id, b.x AS b_x, "
                 "b.y AS b_y "
                 "FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
-                "WHERE a_1.id IN ([POSTCOMPILE_primary_keys])",
+                "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 3]}],
             ),
         )
@@ -3341,7 +3341,7 @@ class M2OWDegradeTest(
             ),
             CompiledSQL(
                 "SELECT b.id AS b_id, b.x AS b_x, b.y AS b_y "
-                "FROM b WHERE b.id IN ([POSTCOMPILE_primary_keys])",
+                "FROM b WHERE b.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2]}],
             ),
         )
@@ -3373,7 +3373,7 @@ class M2OWDegradeTest(
             CompiledSQL(
                 "SELECT a_1.id AS a_1_id, b.id AS b_id, b.x AS b_x, "
                 "b.y AS b_y FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
-                "WHERE a_1.id IN ([POSTCOMPILE_primary_keys])",
+                "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2, 3, 4, 5]}],
             ),
         )
@@ -3408,7 +3408,7 @@ class M2OWDegradeTest(
                 "SELECT a_1.id AS a_1_id, b.id AS b_id, b.x AS b_x, "
                 "b.y AS b_y "
                 "FROM a AS a_1 JOIN b ON b.id = a_1.b_id "
-                "WHERE a_1.id IN ([POSTCOMPILE_primary_keys])",
+                "WHERE a_1.id IN (__[POSTCOMPILE_primary_keys])",
                 [{"primary_keys": [1, 2, 3, 4, 5]}],
             ),
         )
@@ -3520,13 +3520,15 @@ class SameNamePolymorphicTest(fixtures.DeclarativeMappedTest):
                 CompiledSQL(
                     "SELECT child_a.parent_id AS child_a_parent_id, "
                     "child_a.id AS child_a_id FROM child_a "
-                    "WHERE child_a.parent_id IN ([POSTCOMPILE_primary_keys])",
+                    "WHERE child_a.parent_id IN "
+                    "(__[POSTCOMPILE_primary_keys])",
                     [{"primary_keys": [1]}],
                 ),
                 CompiledSQL(
                     "SELECT child_b.parent_id AS child_b_parent_id, "
                     "child_b.id AS child_b_id FROM child_b "
-                    "WHERE child_b.parent_id IN ([POSTCOMPILE_primary_keys])",
+                    "WHERE child_b.parent_id IN "
+                    "(__[POSTCOMPILE_primary_keys])",
                     [{"primary_keys": [2]}],
                 ),
             ),
index 3ced05df215b05b83c6f7ef43b761055da18c78a..4eef97369e773b5ab034804098e0136384b7a149 100644 (file)
@@ -4174,7 +4174,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         )
         self.assert_compile(
             expr,
-            "(mytable.myid, mytable.name) IN " "([POSTCOMPILE_param_1])",
+            "(mytable.myid, mytable.name) IN " "(__[POSTCOMPILE_param_1])",
             checkparams={"param_1": [(1, "foo"), (5, "bar")]},
             check_post_param={"param_1": [(1, "foo"), (5, "bar")]},
             check_literal_execute={},
@@ -4209,7 +4209,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         dialect.tuple_in_values = True
         self.assert_compile(
             tuple_(table1.c.myid, table1.c.name).in_([(1, "foo"), (5, "bar")]),
-            "(mytable.myid, mytable.name) IN " "([POSTCOMPILE_param_1])",
+            "(mytable.myid, mytable.name) IN " "(__[POSTCOMPILE_param_1])",
             dialect=dialect,
             checkparams={"param_1": [(1, "foo"), (5, "bar")]},
             check_post_param={"param_1": [(1, "foo"), (5, "bar")]},
@@ -4345,7 +4345,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
             tuple_(table1.c.myid, table1.c.name).in_(
                 bindparam("foo", expanding=True)
             ),
-            "(mytable.myid, mytable.name) IN ([POSTCOMPILE_foo])",
+            "(mytable.myid, mytable.name) IN (__[POSTCOMPILE_foo])",
         )
 
         dialect = default.DefaultDialect()
@@ -4354,13 +4354,13 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
             tuple_(table1.c.myid, table1.c.name).in_(
                 bindparam("foo", expanding=True)
             ),
-            "(mytable.myid, mytable.name) IN ([POSTCOMPILE_foo])",
+            "(mytable.myid, mytable.name) IN (__[POSTCOMPILE_foo])",
             dialect=dialect,
         )
 
         self.assert_compile(
             table1.c.myid.in_(bindparam("foo", expanding=True)),
-            "mytable.myid IN ([POSTCOMPILE_foo])",
+            "mytable.myid IN (__[POSTCOMPILE_foo])",
         )
 
     def test_limit_offset_select_literal_binds(self):
@@ -4421,7 +4421,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         (
             "one",
             select(literal("someliteral")),
-            "SELECT [POSTCOMPILE_param_1] AS anon_1",
+            "SELECT __[POSTCOMPILE_param_1] AS anon_1",
             dict(
                 check_literal_execute={"param_1": "someliteral"},
                 check_post_param={},
@@ -4430,14 +4430,14 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         (
             "two",
             select(table1.c.myid + 3),
-            "SELECT mytable.myid + [POSTCOMPILE_myid_1] "
+            "SELECT mytable.myid + __[POSTCOMPILE_myid_1] "
             "AS anon_1 FROM mytable",
             dict(check_literal_execute={"myid_1": 3}, check_post_param={}),
         ),
         (
             "three",
             select(table1.c.myid.in_([4, 5, 6])),
-            "SELECT mytable.myid IN ([POSTCOMPILE_myid_1]) "
+            "SELECT mytable.myid IN (__[POSTCOMPILE_myid_1]) "
             "AS anon_1 FROM mytable",
             dict(
                 check_literal_execute={"myid_1": [4, 5, 6]},
@@ -4447,14 +4447,14 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         (
             "four",
             select(func.mod(table1.c.myid, 5)),
-            "SELECT mod(mytable.myid, [POSTCOMPILE_mod_2]) "
+            "SELECT mod(mytable.myid, __[POSTCOMPILE_mod_2]) "
             "AS mod_1 FROM mytable",
             dict(check_literal_execute={"mod_2": 5}, check_post_param={}),
         ),
         (
             "five",
             select(literal("foo").in_([])),
-            "SELECT [POSTCOMPILE_param_1] IN ([POSTCOMPILE_param_2]) "
+            "SELECT __[POSTCOMPILE_param_1] IN (__[POSTCOMPILE_param_2]) "
             "AS anon_1",
             dict(
                 check_literal_execute={"param_1": "foo", "param_2": []},
@@ -4464,7 +4464,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         (
             "six",
             select(literal(util.b("foo"))),
-            "SELECT [POSTCOMPILE_param_1] AS anon_1",
+            "SELECT __[POSTCOMPILE_param_1] AS anon_1",
             dict(
                 check_literal_execute={"param_1": util.b("foo")},
                 check_post_param={},
@@ -4473,7 +4473,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
         (
             "seven",
             select(table1.c.myid == bindparam("foo", callable_=lambda: 5)),
-            "SELECT mytable.myid = [POSTCOMPILE_foo] AS anon_1 FROM mytable",
+            "SELECT mytable.myid = __[POSTCOMPILE_foo] AS anon_1 FROM mytable",
             dict(check_literal_execute={"foo": 5}, check_post_param={}),
         ),
         argnames="stmt, expected, kw",
@@ -4495,7 +4495,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
                 table1.c.myid == bindparam("foo", 5, literal_execute=True)
             ),
             "SELECT mytable.myid FROM mytable "
-            "WHERE mytable.myid = [POSTCOMPILE_foo]",
+            "WHERE mytable.myid = __[POSTCOMPILE_foo]",
         )
 
     def test_render_literal_execute_parameter_literal_binds(self):
@@ -4540,7 +4540,7 @@ class BindParameterTest(AssertsCompiledSQL, fixtures.TestBase):
                 table1.c.myid.in_(bindparam("foo", expanding=True))
             ),
             "SELECT mytable.myid FROM mytable "
-            "WHERE mytable.myid IN ([POSTCOMPILE_foo])",
+            "WHERE mytable.myid IN (__[POSTCOMPILE_foo])",
         )
 
     def test_render_expanding_parameter_literal_binds(self):
@@ -5120,7 +5120,7 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t1),
-            "CREATE TABLE [SCHEMA__none].t1 (q INTEGER)",
+            "CREATE TABLE __[SCHEMA__none].t1 (q INTEGER)",
             schema_translate_map=schema_translate_map,
         )
         self.assert_compile(
@@ -5132,7 +5132,7 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t2),
-            "CREATE TABLE [SCHEMA_foo].t2 (q INTEGER)",
+            "CREATE TABLE __[SCHEMA_foo].t2 (q INTEGER)",
             schema_translate_map=schema_translate_map,
         )
         self.assert_compile(
@@ -5144,7 +5144,7 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t3),
-            "CREATE TABLE [SCHEMA_bar].t3 (q INTEGER)",
+            "CREATE TABLE __[SCHEMA_bar].t3 (q INTEGER)",
             schema_translate_map=schema_translate_map,
         )
         self.assert_compile(
@@ -5165,7 +5165,7 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t1),
-            "CREATE TABLE [SCHEMA__none].t1 (q INTEGER)",
+            "CREATE TABLE __[SCHEMA__none].t1 (q INTEGER)",
             schema_translate_map=schema_translate_map,
         )
         self.assert_compile(
@@ -5177,7 +5177,7 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t2),
-            "CREATE TABLE [SCHEMA_foo % ^ #].t2 (q INTEGER)",
+            "CREATE TABLE __[SCHEMA_foo % ^ #].t2 (q INTEGER)",
             schema_translate_map=schema_translate_map,
         )
         self.assert_compile(
@@ -5189,7 +5189,7 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t3),
-            "CREATE TABLE [SCHEMA_bar {}].t3 (q INTEGER)",
+            "CREATE TABLE __[SCHEMA_bar {}].t3 (q INTEGER)",
             schema_translate_map=schema_translate_map,
         )
         self.assert_compile(
@@ -5234,39 +5234,39 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateSequence(s1),
-            "CREATE SEQUENCE [SCHEMA__none].s1 START WITH 1",
+            "CREATE SEQUENCE __[SCHEMA__none].s1 START WITH 1",
             schema_translate_map=schema_translate_map,
         )
 
         self.assert_compile(
             s1.next_value(),
-            "<next sequence value: [SCHEMA__none].s1>",
+            "<next sequence value: __[SCHEMA__none].s1>",
             schema_translate_map=schema_translate_map,
             dialect="default_enhanced",
         )
 
         self.assert_compile(
             schema.CreateSequence(s2),
-            "CREATE SEQUENCE [SCHEMA_foo].s2 START WITH 1",
+            "CREATE SEQUENCE __[SCHEMA_foo].s2 START WITH 1",
             schema_translate_map=schema_translate_map,
         )
 
         self.assert_compile(
             s2.next_value(),
-            "<next sequence value: [SCHEMA_foo].s2>",
+            "<next sequence value: __[SCHEMA_foo].s2>",
             schema_translate_map=schema_translate_map,
             dialect="default_enhanced",
         )
 
         self.assert_compile(
             schema.CreateSequence(s3),
-            "CREATE SEQUENCE [SCHEMA_bar].s3 START WITH 1",
+            "CREATE SEQUENCE __[SCHEMA_bar].s3 START WITH 1",
             schema_translate_map=schema_translate_map,
         )
 
         self.assert_compile(
             s3.next_value(),
-            "<next sequence value: [SCHEMA_bar].s3>",
+            "<next sequence value: __[SCHEMA_bar].s3>",
             schema_translate_map=schema_translate_map,
             dialect="default_enhanced",
         )
@@ -5304,24 +5304,24 @@ class DDLTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             schema.CreateTable(t1),
-            "CREATE TABLE [SCHEMA__none].t1 "
-            "(id INTEGER DEFAULT <next sequence value: [SCHEMA__none].s1> "
+            "CREATE TABLE __[SCHEMA__none].t1 "
+            "(id INTEGER DEFAULT <next sequence value: __[SCHEMA__none].s1> "
             "NOT NULL, PRIMARY KEY (id))",
             schema_translate_map=schema_translate_map,
             dialect="default_enhanced",
         )
         self.assert_compile(
             schema.CreateTable(t2),
-            "CREATE TABLE [SCHEMA__none].t2 "
-            "(id INTEGER DEFAULT <next sequence value: [SCHEMA_foo].s2> "
+            "CREATE TABLE __[SCHEMA__none].t2 "
+            "(id INTEGER DEFAULT <next sequence value: __[SCHEMA_foo].s2> "
             "NOT NULL, PRIMARY KEY (id))",
             schema_translate_map=schema_translate_map,
             dialect="default_enhanced",
         )
         self.assert_compile(
             schema.CreateTable(t3),
-            "CREATE TABLE [SCHEMA__none].t3 "
-            "(id INTEGER DEFAULT <next sequence value: [SCHEMA_bar].s3> "
+            "CREATE TABLE __[SCHEMA__none].t3 "
+            "(id INTEGER DEFAULT <next sequence value: __[SCHEMA_bar].s3> "
             "NOT NULL, PRIMARY KEY (id))",
             schema_translate_map=schema_translate_map,
             dialect="default_enhanced",
@@ -5515,12 +5515,12 @@ class SchemaTest(fixtures.TestBase, AssertsCompiledSQL):
 
         self.assert_compile(
             stmt,
-            "SELECT [SCHEMA__none].myothertable.otherid, "
-            "[SCHEMA__none].myothertable.othername, "
+            "SELECT __[SCHEMA__none].myothertable.otherid, "
+            "__[SCHEMA__none].myothertable.othername, "
             "mytable_1.myid, mytable_1.name, mytable_1.description "
-            "FROM [SCHEMA__none].myothertable JOIN "
-            "[SCHEMA__none].mytable AS mytable_1 "
-            "ON [SCHEMA__none].myothertable.otherid = mytable_1.myid "
+            "FROM __[SCHEMA__none].myothertable JOIN "
+            "__[SCHEMA__none].mytable AS mytable_1 "
+            "ON __[SCHEMA__none].myothertable.otherid = mytable_1.myid "
             "WHERE mytable_1.name = :name_1",
             schema_translate_map=schema_translate_map,
         )
index 22b743434f804eab9ccd132250e8e0795b77de19..28b0310f5dc7c0ce401ca97290dfa728e3d7a931 100644 (file)
@@ -1658,7 +1658,7 @@ class LegacyOperatorTest(AssertsCompiledSQL, fixtures.TestBase):
 
         self.assert_compile(
             column("x").notin_(["foo", "bar"]),
-            "(x NOT IN ([POSTCOMPILE_x_1]))",
+            "(x NOT IN (__[POSTCOMPILE_x_1]))",
         )
 
     def test_issue_5429_operators(self):
index 0d43448d5ed3c6e19e36cbaa3ca43d737361ed58..e01ec0738e9cb76adee8e2873bc53b956296ca9e 100644 (file)
@@ -206,7 +206,7 @@ class TraversalTest(
 
         and the compiler postcompile reg is::
 
-            re.sub(r"\[POSTCOMPILE_(\S+)\]", process_expanding, self.string)
+            re.sub(r"\__[POSTCOMPILE_(\S+)\]", process_expanding, self.string)
 
         Interestingly, brackets in the name seems to work out.
 
@@ -241,7 +241,7 @@ class TraversalTest(
 
         stmt = and_(expr, expr2)
         self.assert_compile(
-            stmt, "x IN ([POSTCOMPILE_x_1]) AND x IN ([POSTCOMPILE_x_1])"
+            stmt, "x IN (__[POSTCOMPILE_x_1]) AND x IN (__[POSTCOMPILE_x_1])"
         )
         self.assert_compile(
             stmt, "x IN (1, 2, 3) AND x IN (1, 2, 3)", literal_binds=True
index a53401a4f1062428dc8049f6a3c37e0b5060abf9..a2aa9705cb16c63509fa135de6d1577722452640 100644 (file)
@@ -152,7 +152,7 @@ class LambdaElementTest(
             asserter_.assert_(
                 CompiledSQL(
                     "SELECT users.id FROM users WHERE users.name "
-                    "IN ([POSTCOMPILE_val_1]) ORDER BY users.id",
+                    "IN (__[POSTCOMPILE_val_1]) ORDER BY users.id",
                     params={"val_1": case},
                 )
             )
@@ -1130,7 +1130,7 @@ class LambdaElementTest(
     def test_in_parameters_one(self):
 
         expr1 = select(1).where(column("q").in_(["a", "b", "c"]))
-        self.assert_compile(expr1, "SELECT 1 WHERE q IN ([POSTCOMPILE_q_1])")
+        self.assert_compile(expr1, "SELECT 1 WHERE q IN (__[POSTCOMPILE_q_1])")
 
         self.assert_compile(
             expr1,
@@ -1141,7 +1141,7 @@ class LambdaElementTest(
 
     def test_in_parameters_two(self):
         expr2 = select(1).where(lambda: column("q").in_(["a", "b", "c"]))
-        self.assert_compile(expr2, "SELECT 1 WHERE q IN ([POSTCOMPILE_q_1])")
+        self.assert_compile(expr2, "SELECT 1 WHERE q IN (__[POSTCOMPILE_q_1])")
         self.assert_compile(
             expr2,
             "SELECT 1 WHERE q IN (:q_1_1, :q_1_2, :q_1_3)",
@@ -1153,7 +1153,7 @@ class LambdaElementTest(
         expr3 = lambdas.lambda_stmt(
             lambda: select(1).where(column("q").in_(["a", "b", "c"]))
         )
-        self.assert_compile(expr3, "SELECT 1 WHERE q IN ([POSTCOMPILE_q_1])")
+        self.assert_compile(expr3, "SELECT 1 WHERE q IN (__[POSTCOMPILE_q_1])")
         self.assert_compile(
             expr3,
             "SELECT 1 WHERE q IN (:q_1_1, :q_1_2, :q_1_3)",
@@ -1169,7 +1169,7 @@ class LambdaElementTest(
 
         expr4 = go(["a", "b", "c"])
         self.assert_compile(
-            expr4, "SELECT 1 WHERE q IN ([POSTCOMPILE_names_1])"
+            expr4, "SELECT 1 WHERE q IN (__[POSTCOMPILE_names_1])"
         )
         self.assert_compile(
             expr4,
@@ -1821,7 +1821,7 @@ class DeferredLambdaElementTest(
             opts=lambdas.LambdaOptions(track_closure_variables=False),
         )
 
-        self.assert_compile(elem.expr, "t1.q IN ([POSTCOMPILE_vv_1])")
+        self.assert_compile(elem.expr, "t1.q IN (__[POSTCOMPILE_vv_1])")
 
         assert_raises_message(
             exc.InvalidRequestError,
index 3bb097714b19400818c3c92ec83296bbe82c2609..45ea3054811e288705c756c56b501ca321edfa47 100644 (file)
@@ -1414,14 +1414,14 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         self.assert_compile(
             self.table2.select().where(5 + self.table2.c.field.in_([5, 6])),
             "SELECT op.field FROM op WHERE :param_1 + "
-            "(op.field IN ([POSTCOMPILE_field_1]))",
+            "(op.field IN (__[POSTCOMPILE_field_1]))",
         )
 
     def test_operator_precedence_6(self):
         self.assert_compile(
             self.table2.select().where((5 + self.table2.c.field).in_([5, 6])),
             "SELECT op.field FROM op WHERE :field_1 + op.field "
-            "IN ([POSTCOMPILE_param_1])",
+            "IN (__[POSTCOMPILE_param_1])",
         )
 
     def test_operator_precedence_7(self):
@@ -1765,28 +1765,28 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
     def test_in_1(self):
         self.assert_compile(
             self.table1.c.myid.in_(["a"]),
-            "mytable.myid IN ([POSTCOMPILE_myid_1])",
+            "mytable.myid IN (__[POSTCOMPILE_myid_1])",
             checkparams={"myid_1": ["a"]},
         )
 
     def test_in_2(self):
         self.assert_compile(
             ~self.table1.c.myid.in_(["a"]),
-            "(mytable.myid NOT IN ([POSTCOMPILE_myid_1]))",
+            "(mytable.myid NOT IN (__[POSTCOMPILE_myid_1]))",
             checkparams={"myid_1": ["a"]},
         )
 
     def test_in_3(self):
         self.assert_compile(
             self.table1.c.myid.in_(["a", "b"]),
-            "mytable.myid IN ([POSTCOMPILE_myid_1])",
+            "mytable.myid IN (__[POSTCOMPILE_myid_1])",
             checkparams={"myid_1": ["a", "b"]},
         )
 
     def test_in_4(self):
         self.assert_compile(
             self.table1.c.myid.in_(iter(["a", "b"])),
-            "mytable.myid IN ([POSTCOMPILE_myid_1])",
+            "mytable.myid IN (__[POSTCOMPILE_myid_1])",
             checkparams={"myid_1": ["a", "b"]},
         )
 
@@ -1881,7 +1881,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
     def test_in_19(self):
         self.assert_compile(
             self.table1.c.myid.in_([1, 2, 3]),
-            "mytable.myid IN ([POSTCOMPILE_myid_1])",
+            "mytable.myid IN (__[POSTCOMPILE_myid_1])",
             checkparams={"myid_1": [1, 2, 3]},
         )
 
@@ -1988,7 +1988,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         if is_in:
             self.assert_compile(
                 expr,
-                "(a, b, c) %s ([POSTCOMPILE_param_1])"
+                "(a, b, c) %s (__[POSTCOMPILE_param_1])"
                 % ("IN" if is_in else "NOT IN"),
                 checkparams={"param_1": [(3, "hi", b"there"), (4, "Q", b"P")]},
             )
@@ -2001,7 +2001,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         else:
             self.assert_compile(
                 expr,
-                "((a, b, c) NOT IN ([POSTCOMPILE_param_1]))",
+                "((a, b, c) NOT IN (__[POSTCOMPILE_param_1]))",
                 checkparams={"param_1": [(3, "hi", b"there"), (4, "Q", b"P")]},
             )
             self.assert_compile(
@@ -2028,7 +2028,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         if is_in:
             self.assert_compile(
                 expr,
-                "(a, b, c) IN ([POSTCOMPILE_param_1])",
+                "(a, b, c) IN (__[POSTCOMPILE_param_1])",
                 checkparams={"param_1": []},
             )
             self.assert_compile(
@@ -2040,7 +2040,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         else:
             self.assert_compile(
                 expr,
-                "((a, b, c) NOT IN ([POSTCOMPILE_param_1]))",
+                "((a, b, c) NOT IN (__[POSTCOMPILE_param_1]))",
                 checkparams={"param_1": []},
             )
             self.assert_compile(
@@ -2063,7 +2063,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         if is_in:
             self.assert_compile(
                 expr,
-                "a IN ([POSTCOMPILE_a_1])",
+                "a IN (__[POSTCOMPILE_a_1])",
                 checkparams={"a_1": []},
             )
             self.assert_compile(
@@ -2075,7 +2075,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         else:
             self.assert_compile(
                 expr,
-                "(a NOT IN ([POSTCOMPILE_a_1]))",
+                "(a NOT IN (__[POSTCOMPILE_a_1]))",
                 checkparams={"a_1": []},
             )
             self.assert_compile(
@@ -2093,7 +2093,8 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
         stmt = and_(expr1, expr2)
         self.assert_compile(
-            stmt, "a IN ([POSTCOMPILE_a_1]) AND (a NOT IN ([POSTCOMPILE_a_2]))"
+            stmt,
+            "a IN (__[POSTCOMPILE_a_1]) AND (a NOT IN (__[POSTCOMPILE_a_2]))",
         )
         self.assert_compile(
             stmt, "a IN (5) AND (a NOT IN (5))", literal_binds=True
@@ -2107,7 +2108,8 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
         stmt = and_(expr1, expr2)
         self.assert_compile(
-            stmt, "a IN ([POSTCOMPILE_a_1]) AND (a NOT IN ([POSTCOMPILE_a_2]))"
+            stmt,
+            "a IN (__[POSTCOMPILE_a_1]) AND (a NOT IN (__[POSTCOMPILE_a_2]))",
         )
         self.assert_compile(
             stmt,
@@ -2119,7 +2121,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         s = {1, 2, 3}
         self.assert_compile(
             self.table1.c.myid.in_(s),
-            "mytable.myid IN ([POSTCOMPILE_myid_1])",
+            "mytable.myid IN (__[POSTCOMPILE_myid_1])",
             checkparams={"myid_1": list(s)},
         )
 
@@ -2137,7 +2139,7 @@ class InTest(fixtures.TestBase, testing.AssertsCompiledSQL):
         seq = MySeq([1, 2, 3])
         self.assert_compile(
             self.table1.c.myid.in_(seq),
-            "mytable.myid IN ([POSTCOMPILE_myid_1])",
+            "mytable.myid IN (__[POSTCOMPILE_myid_1])",
             checkparams={"myid_1": [1, 2, 3]},
         )
 
index e68e98a3ccb41afbe2787b47f3c58715817b7853..f0df92b7051f0dc091a0a4f402a7478c6185153d 100644 (file)
@@ -2948,7 +2948,7 @@ class AnnotationsTest(fixtures.TestBase):
             (table1.c.col1 == 5, "table1.col1 = :col1_1"),
             (
                 table1.c.col1.in_([2, 3, 4]),
-                "table1.col1 IN ([POSTCOMPILE_col1_1])",
+                "table1.col1 IN (__[POSTCOMPILE_col1_1])",
             ),
         ]:
             eq_(str(expr), expected)
index adcaef39cb4fbb71ec27f817c9265513031d0bd4..e0e0858a45093185ec7317108bd61646e4a06eb2 100644 (file)
@@ -191,7 +191,7 @@ class SelectTest(_ExprFixture, fixtures.TestBase, AssertsCompiledSQL):
             ),
             "SELECT test_table.x, lower(test_table.y) AS y FROM "
             "test_table WHERE test_table.y IN "
-            "([POSTCOMPILE_y_1~~lower(~~REPL~~)~~])",
+            "(__[POSTCOMPILE_y_1~~lower(~~REPL~~)~~])",
             render_postcompile=False,
         )