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

Method add_property

lib/sqlalchemy/orm/mapper.py:2444–2459  ·  view source on GitHub ↗

Add an individual MapperProperty to this mapper. If the mapper has not been configured yet, just adds the property to the initial properties dictionary sent to the constructor. If this Mapper has already been configured, then the given MapperProperty is configured i

(
        self, key: str, prop: Union[Column[Any], MapperProperty[Any]]
    )

Source from the content-addressed store, hash-verified

2442 self.add_property(key, value)
2443
2444 def add_property(
2445 self, key: str, prop: Union[Column[Any], MapperProperty[Any]]
2446 ) -> None:
2447 """Add an individual MapperProperty to this mapper.
2448
2449 If the mapper has not been configured yet, just adds the
2450 property to the initial properties dictionary sent to the
2451 constructor. If this Mapper has already been configured, then
2452 the given MapperProperty is configured immediately.
2453
2454 """
2455 prop = self._configure_property(
2456 key, prop, init=self.configured, warn_for_existing=True
2457 )
2458 assert isinstance(prop, MapperProperty)
2459 self._init_properties[key] = prop
2460
2461 def _expire_memoizations(self) -> None:
2462 for mapper in self.iterate_to_root():

Callers 15

add_propertiesMethod · 0.95
_add_attributeFunction · 0.80
setup_mappersMethod · 0.80
test_column_propertyMethod · 0.80
test_late_compileMethod · 0.80
test_splice_onto_acMethod · 0.80
setup_mappersMethod · 0.80
test_oneMethod · 0.80

Calls 1

_configure_propertyMethod · 0.95

Tested by 15

setup_mappersMethod · 0.64
test_column_propertyMethod · 0.64
test_late_compileMethod · 0.64
test_splice_onto_acMethod · 0.64
setup_mappersMethod · 0.64
test_oneMethod · 0.64
test_add_propertyMethod · 0.64
setup_propsMethod · 0.64