(self, query, value)
return result
Retrieve the related object from an existing instance in the DB.

        :param query: A SQLAlchemy `Query <sqlalchemy.orm.query.Query>` object.
        :param value: The serialized value to mapto an existing instance.
        :raises NoResultFound: if there is no matching record.
Retrieve the related object from an existing instance in the DB.
Retrieve the related object from an existing instance in the DB .
def _get_existing_instance(self, query, value):
        """Retrieve the related object from an existing instance in the DB.

        :param query: A SQLAlchemy `Query <sqlalchemy.orm.query.Query>` object.
        :param value: The serialized value to mapto an existing instance.
        :raises NoResultFound: if there is no matching record.
        """
        if self.columns:
            result = query.filter_by(
                **{prop.key: value.get(prop.key) for prop in self.related_keys}
            ).one()
        else:
            # Use a faster path if the related key is the primary key.
            lookup_values = [value.get(prop.key) for prop in self.related_keys]
            try:
                result = query.get(lookup_values)
            except TypeError:
                keys = [prop.key for prop in self.related_keys]
                raise self.make_error("invalid", value=value, keys=keys)
            if result is None:
                raise NoResultFound
        return result
def _get_existing_instance ( self , query , value ) : if self . columns : result = query . filter_by ( * * { prop . key : value . get ( prop . key ) for prop in self . related_keys } ) . one ( ) else : # Use a faster path if the related key is the primary key. lookup_values = [ value . get ( prop . key ) for prop in self . related_keys ] try : result = query . get ( lookup_values ) except TypeError : keys = [ prop . key for prop in self . related_keys ] raise self . make_error ( "invalid" , value = value , keys = keys ) if result is None : raise NoResultFound return result