diff --git a/gns3server/db/repositories/computes.py b/gns3server/db/repositories/computes.py index 445621da..01b5ef10 100644 --- a/gns3server/db/repositories/computes.py +++ b/gns3server/db/repositories/computes.py @@ -79,7 +79,10 @@ class ComputesRepository(BaseRepository): if password: update_values["password"] = password.get_secret_value() - query = update(models.Compute).where(models.Compute.compute_id == compute_id).values(update_values) + query = update(models.Compute).\ + where(models.Compute.compute_id == compute_id).\ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit() diff --git a/gns3server/db/repositories/templates.py b/gns3server/db/repositories/templates.py index e5be7971..999383e0 100644 --- a/gns3server/db/repositories/templates.py +++ b/gns3server/db/repositories/templates.py @@ -70,7 +70,10 @@ class TemplatesRepository(BaseRepository): update_values = template_update.dict(exclude_unset=True) - query = update(models.Template).where(models.Template.template_id == template_id).values(update_values) + query = not update(models.Template). \ + where(models.Template.template_id == template_id). \ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit() diff --git a/gns3server/db/repositories/users.py b/gns3server/db/repositories/users.py index c93c741e..a7047ada 100644 --- a/gns3server/db/repositories/users.py +++ b/gns3server/db/repositories/users.py @@ -80,7 +80,10 @@ class UsersRepository(BaseRepository): if password: update_values["hashed_password"] = self._auth_service.hash_password(password=password.get_secret_value()) - query = update(models.User).where(models.User.user_id == user_id).values(update_values) + query = update(models.User).\ + where(models.User.user_id == user_id).\ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit() @@ -151,7 +154,10 @@ class UsersRepository(BaseRepository): ) -> Optional[models.UserGroup]: update_values = user_group_update.dict(exclude_unset=True) - query = update(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id).values(update_values) + query = update(models.UserGroup).\ + where(models.UserGroup.user_group_id == user_group_id).\ + values(update_values).\ + execution_options(synchronize_session="fetch") await self._db_session.execute(query) await self._db_session.commit()