class_docstr: A builder object for :class:`.query.Query` objects.
class_docstr_tok: ["A","builder","object","for",":","class",":","`",".query.Query","`","objects","."]
code: def _bake(self, session):
      query = self._as_query(session)
      query.session = None
  
      # in 1.4, this is where before_compile() event is
      # invoked
      statement = query._statement_20()
  
      # if the query is not safe to cache, we still do everything as though
      # we did cache it, since the receiver of _bake() assumes subqueryload
      # context was set up, etc.
      #
      # note also we want to cache the statement itself because this
      # allows the statement itself to hold onto its cache key that is
      # used by the Connection, which in itself is more expensive to
      # generate than what BakedQuery was able to provide in 1.3 and prior
  
      if statement._compile_options._bake_ok:
          self._bakery[self._effective_key(session)] = (
              query,
              statement,
          )
  
      return query, statement
  
imports: import collections.abc
  import logging
  from ..None import exc
  from ..None import util
  from ..orm import exc
  from ..orm.query import Query
  from ..orm.session import Session
  from ..sql import func
  from ..sql import literal_column
  from ..sql import util
label_desc: Use image node_id 16 for calling the BakedQuery obj's underlying member method code with example usage: obj._bake(session) and returns: query,  statement