Get the value of an attribute, firing any callables required. This function may be used regardless of instrumentation applied directly to the class, i.e. no descriptors are required. Custom attribute management schemes will need to make usage of this method to make usage of attribut
(instance: object, key: str)
| 2796 | |
| 2797 | |
| 2798 | def get_attribute(instance: object, key: str) -> Any: |
| 2799 | """Get the value of an attribute, firing any callables required. |
| 2800 | |
| 2801 | This function may be used regardless of instrumentation |
| 2802 | applied directly to the class, i.e. no descriptors are required. |
| 2803 | Custom attribute management schemes will need to make usage |
| 2804 | of this method to make usage of attribute state as understood |
| 2805 | by SQLAlchemy. |
| 2806 | |
| 2807 | """ |
| 2808 | state, dict_ = instance_state(instance), instance_dict(instance) |
| 2809 | return state.manager[key].impl.get(state, dict_) |
| 2810 | |
| 2811 | |
| 2812 | def del_attribute(instance: object, key: str) -> None: |