Fix async SQLAlchemy MissingGreenlet error on campaign update
Refresh campaign object after flush to reload expired attributes and relationships, preventing lazy load failures in async context. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
96d459c322
commit
37c2532263
1 changed files with 2 additions and 0 deletions
|
|
@ -90,6 +90,8 @@ class CampaignRepository:
|
|||
setattr(campaign, key, value)
|
||||
|
||||
await self.session.flush()
|
||||
# Refresh to reload expired attributes and relationships after flush
|
||||
await self.session.refresh(campaign, ["agency", "proofs"])
|
||||
return campaign
|
||||
|
||||
async def delete(self, campaign_id: uuid.UUID) -> bool:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue