(state_str(state), instance_key, state_str(existing)))
if self._should_log_debug:
self._log_debug(
- "detected row switch for identity %s. will update %s, remove %s from transaction",
- instance_key, state_str(state), state_str(existing))
+ "detected row switch for identity %s. will update %s, remove %s from "
+ "transaction" % (instance_key, state_str(state), state_str(existing)))
# remove the "delete" flag from the existing element
uowtransaction.set_row_switch(existing)
pks = mapper._pks_by_table[table]
if self._should_log_debug:
- self._log_debug("_save_obj() table '%s' instance %s identity %s" % (table.name, state_str(state), str(instance_key)))
+ self._log_debug("_save_obj() table '%s' instance %s identity %s" %
+ (table.name, state_str(state), str(instance_key)))
isinsert = not has_identity and not postupdate and state not in row_switches
params[col.key] = 1
elif mapper.polymorphic_on and mapper.polymorphic_on.shares_lineage(col):
if self._should_log_debug:
- self._log_debug("Using polymorphic identity '%s' for insert column '%s'" % (mapper.polymorphic_identity, col.key))
+ self._log_debug(
+ "Using polymorphic identity '%s' for insert column '%s'" %
+ (mapper.polymorphic_identity, col.key))
value = mapper.polymorphic_identity
if ((col.default is None and
col.server_default is None) or
dict_ = attributes.instance_dict(instance)
if self._should_log_debug:
- self._log_debug("_instance(): using existing instance %s identity %s",
- instance_str(instance), identitykey)
+ self._log_debug("_instance(): using existing instance %s identity %s" %
+ (instance_str(instance), identitykey))
isnew = state.runid != context.runid
currentload = not isnew
loaded_instance = False
else:
if self._should_log_debug:
- self._log_debug("_instance(): identity key %s not in session", identitykey)
+ self._log_debug("_instance(): identity key %s not in session" % (identitykey,))
if self.allow_null_pks:
for x in identitykey[1]:
instance = self.class_manager.new_instance()
if self._should_log_debug:
- self._log_debug("_instance(): created new instance %s identity %s",
- instance_str(instance), identitykey)
+ self._log_debug("_instance(): created new instance %s identity %s" %
+ (instance_str(instance), identitykey))
dict_ = attributes.instance_dict(instance)
state = attributes.instance_state(instance)
if self._should_log_debug:
new_execute = self.debug_callable(new_execute, self.logger,
"%s returning active column fetcher" % self,
- lambda state, row, **flags: "%s populating %s" % (self, mapperutil.state_attribute_str(state, key))
+ lambda state, dict_, row, **flags: "%s populating %s" % \
+ (self,
+ mapperutil.state_attribute_str(state, key))
)
return (new_execute, None)
else:
if self._should_log_debug:
new_execute = self.debug_callable(new_execute, self.logger,
"%s returning active composite column fetcher" % self,
- lambda state, row, **flags: "populating %s" % (mapperutil.state_attribute_str(state, key))
+ lambda state, dict_, row, **flags: "populating %s" % \
+ (mapperutil.state_attribute_str(state, key))
)
return (new_execute, None)
if self._should_log_debug:
new_execute = self.debug_callable(new_execute, self.logger, None,
- lambda state, row, **flags: "set deferred callable on %s" % mapperutil.state_attribute_str(state, self.key)
+ lambda state, dict_, row, **flags: "set deferred callable on %s" % \
+ mapperutil.state_attribute_str(state, self.key)
)
return (new_execute, None)
if self._should_log_debug:
new_execute = self.debug_callable(new_execute, self.logger, None,
- lambda state, row, **flags: "initializing blank scalar/collection on %s" % mapperutil.state_attribute_str(state, self.key)
+ lambda state, dict_, row, **flags: "initializing blank scalar/collection on %s" % \
+ mapperutil.state_attribute_str(state, self.key)
)
return (new_execute, None)
def create_row_processor(self, selectcontext, path, mapper, row, adapter):
if not self.is_class_level:
def new_execute(state, dict_, row, **flags):
- # we are not the primary manager for this attribute on this class - set up a per-instance lazyloader,
- # which will override the class-level behavior.
- # this currently only happens when using a "lazyload" option on a "no load" attribute -
- # "eager" attributes always have a class-level lazyloader installed.
+ # we are not the primary manager for this attribute on this class - set up a
+ # per-instance lazyloader, which will override the class-level behavior.
+ # this currently only happens when using a "lazyload" option on a "no load"
+ # attribute - "eager" attributes always have a class-level lazyloader
+ # installed.
self._init_instance_attribute(state, callable_=LoadLazyAttribute(state, self.key))
if self._should_log_debug:
new_execute = self.debug_callable(new_execute, self.logger, None,
- lambda state, row, **flags: "set instance-level lazy loader on %s" % mapperutil.state_attribute_str(state, self.key)
+ lambda state, dict_, row, **flags: "set instance-level lazy loader on %s" % \
+ mapperutil.state_attribute_str(state,
+ self.key)
)
return (new_execute, None)
else:
def new_execute(state, dict_, row, **flags):
- # we are the primary manager for this attribute on this class - reset its per-instance attribute state,
- # so that the class-level lazy loader is executed when next referenced on this instance.
- # this is needed in populate_existing() types of scenarios to reset any existing state.
+ # we are the primary manager for this attribute on this class - reset its
+ # per-instance attribute state, so that the class-level lazy loader is
+ # executed when next referenced on this instance. this is needed in
+ # populate_existing() types of scenarios to reset any existing state.
state.reset(self.key, dict_)
if self._should_log_debug:
new_execute = self.debug_callable(new_execute, self.logger, None,
- lambda state, row, **flags: "set class-level lazy loader on %s" % mapperutil.state_attribute_str(state, self.key)
+ lambda state, dict_, row, **flags: "set class-level lazy loader on %s" % \
+ mapperutil.state_attribute_str(state,
+ self.key)
)
return (new_execute, None)
if self._should_log_debug:
execute = self.debug_callable(execute, self.logger,
"%s returning eager instance loader" % self,
- lambda state, row, isnew, **flags: "%s eagerload %s" % (self, self.uselist and "scalar attribute" or "collection")
+ lambda state, dict_, row, isnew, **flags: "%s eagerload %s" % \
+ (self,
+ self.uselist and "scalar attribute"
+ or "collection")
)
return (execute, execute)