MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / init_class_attribute

Method init_class_attribute

lib/sqlalchemy/orm/strategies.py:241–262  ·  view source on GitHub ↗
(self, mapper)

Source from the content-addressed store, hash-verified

239 memoized_populators[self.parent_property] = fetch
240
241 def init_class_attribute(self, mapper):
242 self.is_class_level = True
243 coltype = self.columns[0].type
244 # TODO: check all columns ? check for foreign key as well?
245 active_history = (
246 self.parent_property.active_history
247 or self.columns[0].primary_key
248 or (
249 mapper.version_id_col is not None
250 and mapper._columntoproperty.get(mapper.version_id_col, None)
251 is self.parent_property
252 )
253 )
254
255 _register_attribute(
256 self.parent_property,
257 mapper,
258 useobject=False,
259 compare_function=coltype.compare_values,
260 active_history=active_history,
261 default_scalar_value=self.parent_property._default_scalar_value,
262 )
263
264 def create_row_processor(
265 self,

Callers

nothing calls this directly

Calls 2

_register_attributeFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected