MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / prefetch_cols

Method prefetch_cols

lib/sqlalchemy/engine/cursor.py:2173–2194  ·  view source on GitHub ↗

Return ``prefetch_cols()`` from the underlying :class:`.ExecutionContext`. See :class:`.ExecutionContext` for details. Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed statement is not a compiled expression construct or is not an insert()

(self)

Source from the content-addressed store, hash-verified

2171 return self.context.postfetch_cols
2172
2173 def prefetch_cols(self) -> Optional[Sequence[Column[Any]]]:
2174 """Return ``prefetch_cols()`` from the underlying
2175 :class:`.ExecutionContext`.
2176
2177 See :class:`.ExecutionContext` for details.
2178
2179 Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
2180 statement is not a compiled expression construct
2181 or is not an insert() or update() construct.
2182
2183 """
2184
2185 if not self.context.compiled:
2186 raise exc.InvalidRequestError(
2187 "Statement is not a compiled expression construct."
2188 )
2189 elif not self.context.isinsert and not self.context.isupdate:
2190 raise exc.InvalidRequestError(
2191 "Statement is not an insert() or update() "
2192 "expression construct."
2193 )
2194 return self.context.prefetch_cols
2195
2196 def supports_sane_rowcount(self) -> bool:
2197 """Return ``supports_sane_rowcount`` from the dialect.

Calls

no outgoing calls