@@ -1071,22 +1071,22 @@ an IN expression::
10711071The pre-execution string representation is::
10721072
10731073 >>> print(stmt)
1074- SELECT a.id, a.data
1074+ {printsql} SELECT a.id, a.data
10751075 FROM a
10761076 WHERE a.id IN ([POSTCOMPILE_id_1])
10771077
10781078To render the values directly, use ``literal_binds `` as was the case previously::
10791079
10801080 >>> print(stmt.compile(compile_kwargs={"literal_binds": True}))
1081- SELECT a.id, a.data
1081+ {printsql} SELECT a.id, a.data
10821082 FROM a
10831083 WHERE a.id IN (1, 2, 3)
10841084
10851085A new flag, "render_postcompile", is added as a helper to allow the current
10861086bound value to be rendered as it would be passed to the database::
10871087
10881088 >>> print(stmt.compile(compile_kwargs={"render_postcompile": True}))
1089- SELECT a.id, a.data
1089+ {printsql} SELECT a.id, a.data
10901090 FROM a
10911091 WHERE a.id IN (:id_1_1, :id_1_2, :id_1_3)
10921092
@@ -1260,7 +1260,7 @@ method will not emit a warning unless the linting flag is supplied::
12601260 >>> from sqlalchemy.sql import FROM_LINTING
12611261 >>> print(q.statement.compile(linting=FROM_LINTING))
12621262 SAWarning: SELECT statement has a cartesian product between FROM element(s) "addresses" and FROM element "users". Apply join condition(s) between each element to resolve.
1263- SELECT users.id, users.name, users.fullname, users.nickname
1263+ {printsql} SELECT users.id, users.name, users.fullname, users.nickname
12641264 FROM addresses, users JOIN addresses AS addresses_1 ON users.id = addresses_1.user_id
12651265 WHERE addresses.email_address = :email_address_1
12661266
@@ -1538,7 +1538,7 @@ such as :class:`.Subquery` and :class:`_expression.Alias`::
15381538 ]
15391539
15401540 >>> print(stmt.subquery().select())
1541- SELECT anon_1.c1, anon_1.c2, anon_1.c2, anon_1.c2, anon_1.c4
1541+ {printsql} SELECT anon_1.c1, anon_1.c2, anon_1.c2, anon_1.c2, anon_1.c4
15421542 FROM (SELECT c1, c2, c3 AS c2, c2, c4) AS anon_1
15431543
15441544:class: `_expression.ColumnCollection ` also allows access by integer index to support
@@ -1576,7 +1576,7 @@ as::
15761576 >>> from sqlalchemy import union
15771577 >>> u = union(s1, s2)
15781578 >>> print(u)
1579- SELECT "user".id, "user".name, "user".id
1579+ {printsql} SELECT "user".id, "user".name, "user".id
15801580 FROM "user" UNION SELECT c1, c2, c3
15811581
15821582
@@ -1642,29 +1642,29 @@ reasonable behavior for simple modifications to a single column, most
16421642prominently with CAST::
16431643
16441644 >>> print(select(cast(foo.c.data, String)))
1645- SELECT CAST(foo.data AS VARCHAR) AS data
1645+ {printsql} SELECT CAST(foo.data AS VARCHAR) AS data
16461646 FROM foo
16471647
16481648For CAST against expressions that don't have a name, the previous logic is used
16491649to generate the usual "anonymous" labels::
16501650
16511651 >>> print(select(cast("hi there," + foo.c.data, String)))
1652- SELECT CAST(:data_1 + foo.data AS VARCHAR) AS anon_1
1652+ {printsql} SELECT CAST(:data_1 + foo.data AS VARCHAR) AS anon_1
16531653 FROM foo
16541654
16551655A :func: `.cast ` against a :class: `.Label `, despite having to omit the label
16561656expression as these don't render inside of a CAST, will nonetheless make use of
16571657the given name::
16581658
16591659 >>> print(select(cast(("hi there," + foo.c.data).label("hello_data"), String)))
1660- SELECT CAST(:data_1 + foo.data AS VARCHAR) AS hello_data
1660+ {printsql} SELECT CAST(:data_1 + foo.data AS VARCHAR) AS hello_data
16611661 FROM foo
16621662
16631663And of course as was always the case, :class: `.Label ` can be applied to the
16641664expression on the outside to apply an "AS <name>" label directly::
16651665
16661666 >>> print(select(cast(("hi there," + foo.c.data), String).label("hello_data")))
1667- SELECT CAST(:data_1 + foo.data AS VARCHAR) AS hello_data
1667+ {printsql} SELECT CAST(:data_1 + foo.data AS VARCHAR) AS hello_data
16681668 FROM foo
16691669
16701670
@@ -2291,7 +2291,7 @@ the ``.data`` column attribute, the object is refreshed and this will now
22912291include the joinedload operation as well::
22922292
22932293 >>> a1.data
2294- SELECT a.id AS a_id, a.data AS a_data, b_1.id AS b_1_id, b_1.a_id AS b_1_a_id
2294+ {execsql} SELECT a.id AS a_id, a.data AS a_data, b_1.id AS b_1_id, b_1.a_id AS b_1_a_id
22952295 FROM a LEFT OUTER JOIN b AS b_1 ON a.id = b_1.a_id
22962296 WHERE a.id = ?
22972297
@@ -2310,7 +2310,7 @@ an additional query::
23102310 >>> a1.data = "new data"
23112311 >>> session.commit()
23122312 >>> a1.data
2313- SELECT a.id AS a_id, a.data AS a_data
2313+ {execsql} SELECT a.id AS a_id, a.data AS a_data
23142314 FROM a
23152315 WHERE a.id = ?
23162316 (1,)
0 commit comments