MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / render_literal_execute

Method render_literal_execute

lib/sqlalchemy/sql/elements.py:2105–2128  ·  view source on GitHub ↗

Produce a copy of this bound parameter that will enable the :paramref:`_sql.BindParameter.literal_execute` flag. The :paramref:`_sql.BindParameter.literal_execute` flag will have the effect of the parameter rendered in the compiled SQL string using ``[POSTCOMPILE]``

(self)

Source from the content-addressed store, hash-verified

2103 return self.value
2104
2105 def render_literal_execute(self) -> BindParameter[_T]:
2106 """Produce a copy of this bound parameter that will enable the
2107 :paramref:`_sql.BindParameter.literal_execute` flag.
2108
2109 The :paramref:`_sql.BindParameter.literal_execute` flag will
2110 have the effect of the parameter rendered in the compiled SQL
2111 string using ``[POSTCOMPILE]`` form, which is a special form that
2112 is converted to be a rendering of the literal value of the parameter
2113 at SQL execution time. The rationale is to support caching
2114 of SQL statement strings that can embed per-statement literal values,
2115 such as LIMIT and OFFSET parameters, in the final SQL string that
2116 is passed to the DBAPI. Dialects in particular may want to use
2117 this method within custom compilation schemes.
2118
2119 .. versionadded:: 1.4.5
2120
2121 .. seealso::
2122
2123 :ref:`engine_thirdparty_caching`
2124
2125 """
2126 c = ClauseElement._clone(self)
2127 c.literal_execute = True
2128 return c
2129
2130 def _negate_in_binary(self, negated_op, original_op):
2131 if self.expand_op is original_op:

Calls 1

_cloneMethod · 0.45