MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / add_property

Method add_property

lib/sqlalchemy/orm/mapper.py:2371–2386  ·  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

2369 self.add_property(key, value)
2370
2371 def add_property(
2372 self, key: str, prop: Union[Column[Any], MapperProperty[Any]]
2373 ) -> None:
2374 """Add an individual MapperProperty to this mapper.
2375
2376 If the mapper has not been configured yet, just adds the
2377 property to the initial properties dictionary sent to the
2378 constructor. If this Mapper has already been configured, then
2379 the given MapperProperty is configured immediately.
2380
2381 """
2382 prop = self._configure_property(
2383 key, prop, init=self.configured, warn_for_existing=True
2384 )
2385 assert isinstance(prop, MapperProperty)
2386 self._init_properties[key] = prop
2387
2388 def _expire_memoizations(self) -> None:
2389 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
test_add_propertyMethod · 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