Return the list of primary key values for the given instance. If the instance's state is expired, calling this method will result in a database check to see if the object has been deleted. If the row no longer exists, :class:`~sqlalchemy.orm.exc.ObjectDeleted
(self, instance: _O)
| 3495 | ) |
| 3496 | |
| 3497 | def primary_key_from_instance(self, instance: _O) -> Tuple[Any, ...]: |
| 3498 | """Return the list of primary key values for the given |
| 3499 | instance. |
| 3500 | |
| 3501 | If the instance's state is expired, calling this method |
| 3502 | will result in a database check to see if the object has been deleted. |
| 3503 | If the row no longer exists, |
| 3504 | :class:`~sqlalchemy.orm.exc.ObjectDeletedError` is raised. |
| 3505 | |
| 3506 | """ |
| 3507 | state = attributes.instance_state(instance) |
| 3508 | identity_key = self._identity_key_from_state( |
| 3509 | state, PassiveFlag.PASSIVE_OFF |
| 3510 | ) |
| 3511 | return identity_key[1] |
| 3512 | |
| 3513 | @HasMemoized.memoized_attribute |
| 3514 | def _persistent_sortkey_fn(self): |