@classmethod
def id_field_name(cls):
    """
        If only one primary_key, then return it. Otherwise, raise ValueError.

        :rtype: str
        """
    if cls._cache_id_field_name is None:
        pk_names = cls.pk_names()
        if len(pk_names) == 1:
            cls._cache_id_field_name = pk_names[0]
        else:
            raise ValueError('{classname} has more than 1 primary key!'.
                format(classname=cls.__name__))
    return cls._cache_id_field_name
