spine-tools / Spine-Toolbox

Spine Toolbox is an open source Python package to manage data, scenarios and workflows for modelling and simulation. You can have your local workflow, but work as a team through version control and SQL databases.
https://www.tools-for-energy-system-modelling.org/
GNU Lesser General Public License v3.0
71 stars 17 forks source link

DB Editor’s refresh button not working #1292

Open ghost opened 3 years ago

ghost commented 3 years ago

Steps to reproduce: 1) Two people have the DB editor open to the same MySQL database 2) Other modifies database and commits 3) Other refreshes

Result: DB editor view is not updated with the modifications after refresh.

Expected: The modifications would be shown in the other user’s db editor view.

manuelma commented 3 years ago

Are these users in different machines/toolbox instances?

Edit: Well obviously they are. This should be easy to solve.

ghost commented 3 years ago

In this case they were on different machines.

manuelma commented 3 years ago

What about the uncommitted changes in the editor that's pressing "Refresh"? How should we merge them with the changes made to the db by the other editor?

jkiviluo commented 3 years ago

What about the uncommitted changes in the editor that's pressing "Refresh"? How should we merge them with the changes made to the db by the other editor?

I suppose the expected behavior would be to see the the changes made by someone else and keep your own changes as uncommitted. That may be difficult in practice.

manuelma commented 3 years ago

I think it's possible to save the session and then merge it back after refreshing, but there might be conflicts. My question is more about what to do with the conflicts? Say I added an object to class unit and then the other editor renamed unit to something_else. Any ideas? Otherwise we can just ignore conflicts which in this example, probably means that the unit class is reinstated with that only object...

jkiviluo commented 3 years ago

Handling those conflicts would require referential integrity between diff and regular tables. I think it sounds too much work (and might have serious problems) and we should just live with the possible conflicts until there are resources for a sound re-think. Probably should go into "roadmap".

manuelma commented 3 years ago

Handling those conflicts would require referential integrity...

It can be done without ref. integrity, just by looking at names. We have all the api to do it so maybe we can try that, and if it becomes too confusing for the user (which I'm afraid it might), we just prompt them and tell them that refreshing will discard their dirty changes.

we should just live with the possible conflicts

So by living with them you mean discarding them, right?