code: def load_scalar_attributes(mapper, state, attribute_names, passive):
      """initiate a column-based attribute refresh operation."""
  
      # assert mapper is _state_mapper(state)
      session = state.session
      if not session:
          raise orm_exc.DetachedInstanceError(
              "Instance %s is not bound to a Session; "
              "attribute refresh operation cannot proceed"
              % (state_str(state))
          )
  
      no_autoflush = bool(passive & attributes.NO_AUTOFLUSH)
  
      # in the case of inheritance, particularly concrete and abstract
      # concrete inheritance, the class manager might have some keys
      # of attributes on the superclass that we didn't actually map.
      # These could be mapped as "concrete, don't load" or could be completely
      # excluded from the mapping and we know nothing about them.  Filter them
      # here to prevent them from coming through.
      if attribute_names:
          attribute_names = attribute_names.intersection(
              mapper.attrs.keys()
          )
  
      if mapper.inherits and not mapper.concrete:
          # load based on committed attributes in the object, formed into
          # a truncated SELECT that only includes relevant tables.  does not
          # currently use state.key
          statement = mapper._optimized_get_statement(
              state, attribute_names
          )
          if statement is not None:
              # undefer() isn't needed here because statement has the
              # columns needed already, this implicitly undefers that column
              stmt = FromStatement(mapper, statement)
  
              return load_on_ident(
                  session,
                  stmt,
                  None,
                  only_load_props=attribute_names,
                  refresh_state=state,
                  no_autoflush=no_autoflush,
              )
  
      # normal load, use state.key as the identity to SELECT
      has_key = bool(state.key)
  
      if has_key:
          identity_key = state.key
      else:
          # this codepath is rare - only valid when inside a flush, and the
          # object is becoming persistent but hasn't yet been assigned
          # an identity_key.
          # check here to ensure we have the attrs we need.
          pk_attrs = [
              mapper._columntoproperty[col].key
              for col in mapper.primary_key
          ]
          if state.expired_attributes.intersection(pk_attrs):
              raise sa_exc.InvalidRequestError(
                  "Instance %s cannot be refreshed - it's not "
                  " persistent and does not "
                  "contain a full primary key." % state_str(state)
              )
          identity_key = mapper._identity_key_from_state(state)
  
      if (
          _none_set.issubset(identity_key)
          and not mapper.allow_partial_pks
      ) or _none_set.issuperset(identity_key):
          util.warn_limited(
              "Instance %s to be refreshed doesn't "
              "contain a full primary key - can't be refreshed "
              "(and shouldn't be expired, either).",
              state_str(state),
          )
          return
  
      result = load_on_ident(
          session,
          select(mapper).set_label_style(
              LABEL_STYLE_TABLENAME_PLUS_COL
          ),
          identity_key,
          refresh_state=state,
          only_load_props=attribute_names,
          no_autoflush=no_autoflush,
      )
  
      # if instance is pending, a refresh operation
      # may not complete (even if PK attributes are assigned)
      if has_key and result is None:
          raise orm_exc.ObjectDeletedError(state)
  
imports: from __future__ import annotations
  from typing import Any
  from typing import Dict
  from typing import Iterable
  from typing import List
  from typing import Mapping
  from typing import Optional
  from typing import Sequence
  from typing import Tuple
  from typing import TYPE_CHECKING
  from typing import TypeVar
  from typing import Union
  from .None import attributes
  from .None import exc
  from .None import path_registry
  from .base import _DEFER_FOR_STATE
  from .base import _RAISE_FOR_STATE
  from .base import _SET_DEFERRED_EXPIRED
  from .base import PassiveFlag
  from .context import FromStatement
  from .context import ORMCompileState
  from .context import QueryContext
  from .util import _none_set
  from .util import state_str
  from ..None import exc
  from ..None import util
  from ..engine import result_tuple
  from ..engine.result import ChunkedIteratorResult
  from ..engine.result import FrozenResult
  from ..engine.result import SimpleResultMetaData
  from ..sql import select
  from ..sql import util
  from ..sql.selectable import ForUpdateArg
  from ..sql.selectable import LABEL_STYLE_TABLENAME_PLUS_COL
  from ..sql.selectable import SelectState
  from ..util import EMPTY_DICT
label_desc: Use image node_id 16 for calling a global function with example usage: load_scalar_attributes(mapper, state, attribute_names, passive) and returns: load_on_ident