(self, session)
| 221 | return query.with_session(session) |
| 222 | |
| 223 | def _bake(self, session): |
| 224 | query = self._as_query(session) |
| 225 | query.session = None |
| 226 | |
| 227 | # in 1.4, this is where before_compile() event is |
| 228 | # invoked |
| 229 | statement = query._statement_20() |
| 230 | |
| 231 | # if the query is not safe to cache, we still do everything as though |
| 232 | # we did cache it, since the receiver of _bake() assumes subqueryload |
| 233 | # context was set up, etc. |
| 234 | # |
| 235 | # note also we want to cache the statement itself because this |
| 236 | # allows the statement itself to hold onto its cache key that is |
| 237 | # used by the Connection, which in itself is more expensive to |
| 238 | # generate than what BakedQuery was able to provide in 1.3 and prior |
| 239 | |
| 240 | if statement._compile_options._bake_ok: |
| 241 | self._bakery[self._effective_key(session)] = ( |
| 242 | query, |
| 243 | statement, |
| 244 | ) |
| 245 | |
| 246 | return query, statement |
| 247 | |
| 248 | def to_query(self, query_or_session): |
| 249 | """Return the :class:`_query.Query` object for use as a subquery. |
no test coverage detected