1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

Use synchronize_session="fetch" when updating values.

This commit is contained in:
grossmj 2021-06-01 15:55:50 +09:30
parent e9b9884ee3
commit 74d820fd0a

View File

@ -94,7 +94,10 @@ class RbacRepository(BaseRepository):
"""
update_values = role_update.dict(exclude_unset=True)
query = update(models.Role).where(models.Role.role_id == role_id).values(update_values)
query = update(models.Role).\
where(models.Role.role_id == role_id).\
values(update_values).\
execution_options(synchronize_session="fetch")
await self._db_session.execute(query)
await self._db_session.commit()
@ -230,7 +233,10 @@ class RbacRepository(BaseRepository):
"""
update_values = permission_update.dict(exclude_unset=True)
query = update(models.Permission).where(models.Permission.permission_id == permission_id).values(update_values)
query = update(models.Permission).\
where(models.Permission.permission_id == permission_id).\
values(update_values).\
execution_options(synchronize_session="fetch")
await self._db_session.execute(query)
await self._db_session.commit()