Skip to content

Commit

Permalink
Changed upsert_institution to return a session.get() (#91)
Browse files Browse the repository at this point in the history
Closes #90 

Updated upsert_institution function to remove the flush and refresh and
simplified to return a session.get(dao, lei) which will return the
latest fully populated FIDao
  • Loading branch information
jcadam14 authored Jan 17, 2024
1 parent 22dc087 commit 21c52a1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/entities/repos/institutions_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ async def upsert_institution(session: AsyncSession, fi: FinancialInstitutionDto)
del fi_data["sbl_institution_type_ids"]

db_fi = await session.merge(FinancialInstitutionDao(**fi_data))
await session.flush([db_fi])
await session.refresh(db_fi)
return db_fi
return await session.get(FinancialInstitutionDao, db_fi.lei)


async def add_domains(
Expand Down

0 comments on commit 21c52a1

Please sign in to comment.