diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2021-11-09 23:52:28 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-11-09 23:52:28 +0000 |
commit | 863a048790c99c0e70abe438744f9858fd6806cb (patch) | |
tree | 0cfbd1a325aa689c07cf1d6efc9902f7acb5fe07 /test | |
parent | 0c6071513fea9d183dc67979a239dff746992571 (diff) | |
parent | b919a0a85afd5066f9188b20ef06ee1b4af884a9 (diff) | |
download | sqlalchemy-863a048790c99c0e70abe438744f9858fd6806cb.tar.gz |
Merge "change the POSTCOMPILE/ SCHEMA symbols to not conflict w mssql quoting" into main
Diffstat (limited to 'test')
28 files changed, 313 insertions, 273 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py index dc6805a2b..e9ff8fb19 100644 --- a/test/dialect/mssql/test_compiler.py +++ b/test/dialect/mssql/test_compiler.py @@ -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}, ), ( diff --git a/test/dialect/mssql/test_query.py b/test/dialect/mssql/test_query.py index 2498de92a..63b2551cd 100644 --- a/test/dialect/mssql/test_query.py +++ b/test/dialect/mssql/test_query.py @@ -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}) diff --git a/test/dialect/oracle/test_compiler.py b/test/dialect/oracle/test_compiler.py index 08158eed4..22ffc888a 100644 --- a/test/dialect/oracle/test_compiler.py +++ b/test/dialect/oracle/test_compiler.py @@ -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), ) diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index ebb4d4b12..715ce6ba8 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -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(), ) diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py index a2fe81a4b..f1efaf7a6 100644 --- a/test/dialect/test_sqlite.py +++ b/test/dialect/test_sqlite.py @@ -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", diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py index 3b691ebc9..750a2dd98 100644 --- a/test/engine/test_execute.py +++ b/test/engine/test_execute.py @@ -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") ) diff --git a/test/orm/declarative/test_mixin.py b/test/orm/declarative/test_mixin.py index 664c00630..f3feb5ddf 100644 --- a/test/orm/declarative/test_mixin.py +++ b/test/orm/declarative/test_mixin.py @@ -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"}, ) diff --git a/test/orm/inheritance/test_deprecations.py b/test/orm/inheritance/test_deprecations.py index 8c807c115..6f370d5e4 100644 --- a/test/orm/inheritance/test_deprecations.py +++ b/test/orm/inheritance/test_deprecations.py @@ -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])", ) diff --git a/test/orm/inheritance/test_poly_loading.py b/test/orm/inheritance/test_poly_loading.py index 35822a29e..c18b21d99 100644 --- a/test/orm/inheritance/test_poly_loading.py +++ b/test/orm/inheritance/test_poly_loading.py @@ -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]}], ), diff --git a/test/orm/inheritance/test_relationship.py b/test/orm/inheritance/test_relationship.py index eeb3a7ed6..d12cb1999 100644 --- a/test/orm/inheritance/test_relationship.py +++ b/test/orm/inheritance/test_relationship.py @@ -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 = "" diff --git a/test/orm/inheritance/test_single.py b/test/orm/inheritance/test_single.py index 30d4549c4..fbafdd85b 100644 --- a/test/orm/inheritance/test_single.py +++ b/test/orm/inheritance/test_single.py @@ -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])", ) diff --git a/test/orm/test_ac_relationships.py b/test/orm/test_ac_relationships.py index 6a050b698..f59d704f3 100644 --- a/test/orm/test_ac_relationships.py +++ b/test/orm/test_ac_relationships.py @@ -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]}], ), ) diff --git a/test/orm/test_deferred.py b/test/orm/test_deferred.py index bfdfb00b7..b14313e8b 100644 --- a/test/orm/test_deferred.py +++ b/test/orm/test_deferred.py @@ -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]}, ), ( diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py index 061cad7e3..5fd876474 100644 --- a/test/orm/test_deprecations.py +++ b/test/orm/test_deprecations.py @@ -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]}, ) diff --git a/test/orm/test_froms.py b/test/orm/test_froms.py index af3dd8a60..6e1c94e12 100644 --- a/test/orm/test_froms.py +++ b/test/orm/test_froms.py @@ -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]}, ) diff --git a/test/orm/test_lockmode.py b/test/orm/test_lockmode.py index e07375484..b296f2240 100644 --- a/test/orm/test_lockmode.py +++ b/test/orm/test_lockmode.py @@ -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", diff --git a/test/orm/test_of_type.py b/test/orm/test_of_type.py index bdf7ab859..09b3cf51c 100644 --- a/test/orm/test_of_type.py +++ b/test/orm/test_of_type.py @@ -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_): diff --git a/test/orm/test_query.py b/test/orm/test_query.py index 98be71f34..5c17cdaef 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -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 diff --git a/test/orm/test_relationship_criteria.py b/test/orm/test_relationship_criteria.py index 86f7e9fc9..7e2c6e04f 100644 --- a/test/orm/test_relationship_criteria.py +++ b/test/orm/test_relationship_criteria.py @@ -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", [ diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py index 94b30f3d0..98de9abad 100644 --- a/test/orm/test_relationships.py +++ b/test/orm/test_relationships.py @@ -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]}], ), ) diff --git a/test/orm/test_selectin_relations.py b/test/orm/test_selectin_relations.py index f01060aab..2add1015f 100644 --- a/test/orm/test_selectin_relations.py +++ b/test/orm/test_selectin_relations.py @@ -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]}], ), ), diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 3ced05df2..4eef97369 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -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, ) diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py index 93e280d4e..315cb550a 100644 --- a/test/sql/test_deprecations.py +++ b/test/sql/test_deprecations.py @@ -1660,7 +1660,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): diff --git a/test/sql/test_external_traversal.py b/test/sql/test_external_traversal.py index 0d43448d5..e01ec0738 100644 --- a/test/sql/test_external_traversal.py +++ b/test/sql/test_external_traversal.py @@ -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 diff --git a/test/sql/test_lambdas.py b/test/sql/test_lambdas.py index a53401a4f..a2aa9705c 100644 --- a/test/sql/test_lambdas.py +++ b/test/sql/test_lambdas.py @@ -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, diff --git a/test/sql/test_operators.py b/test/sql/test_operators.py index 3bb097714..45ea30548 100644 --- a/test/sql/test_operators.py +++ b/test/sql/test_operators.py @@ -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]}, ) diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index e68e98a3c..f0df92b70 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -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) diff --git a/test/sql/test_type_expressions.py b/test/sql/test_type_expressions.py index adcaef39c..e0e0858a4 100644 --- a/test/sql/test_type_expressions.py +++ b/test/sql/test_type_expressions.py @@ -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, ) |