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

Method _validate_polymorphic_identity

lib/sqlalchemy/orm/mapper.py:2013–2024  ·  view source on GitHub ↗
(mapper, state, dict_)

Source from the content-addressed store, hash-verified

2011 self._polymorphic_attr_key = polymorphic_key
2012
2013 def _validate_polymorphic_identity(mapper, state, dict_):
2014 if (
2015 polymorphic_key in dict_
2016 and dict_[polymorphic_key]
2017 not in mapper._acceptable_polymorphic_identities
2018 ):
2019 util.warn_limited(
2020 "Flushing object %s with "
2021 "incompatible polymorphic identity %r; the "
2022 "object may not refresh and/or load correctly",
2023 (state_str(state), dict_[polymorphic_key]),
2024 )
2025
2026 self._set_polymorphic_identity = _set_polymorphic_identity
2027 self._validate_polymorphic_identity = (

Callers 1

Calls 1

state_strFunction · 0.85

Tested by

no test coverage detected