@transaction_atomic_with_retry()<EOL><INDENT>def upsert_entity_relationships(self, queryset, entity_relationships):<DEDENT>
<EOL>if entity_relationships:<EOL><INDENT>list(queryset.select_for_update().values_list(<EOL>'<STR_LIT:id>',<EOL>flat=True<EOL>))<EOL><DEDENT>return manager_utils.sync(<EOL>queryset=queryset,<EOL>model_objs=entity_relationships,<EOL>unique_fields=['<STR_LIT>', '<STR_LIT>'],<EOL>update_fields=[],<EOL>return_upserts=True<EOL>)<EOL>
Upsert entity relationships to the database
:param queryset: The base queryset to use
:param entity_relationships: The entity relationships to ensure exist in the database