industrial-optimization-group / DESDEO

An open source framework for interactive multiobjective optimization methods
https://desdeo.it.jyu.fi
29 stars 22 forks source link

Add db functions #152

Closed maihoangbichtram closed 1 week ago

maihoangbichtram commented 2 weeks ago

for old in old_current_solutions: old.current = False

With update func

await db.update( update(SolutionArchive) .where(SolutionArchive.problem==problem_id, SolutionArchive.current==True) .values(current=False) )

juropo commented 1 week ago

Can you explain what the purpose of these changes is?

maihoangbichtram commented 1 week ago

Instead of fetching all records and update each record with desired value, I call only 1 update function to update the values that matches the filter conditions.

Each call to API will now there its own db session, instead of 1 db session for all calls to API.

maihoangbichtram commented 1 week ago

PR reconstruct