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
73 stars 18 forks source link

Changing data store path (in Data Store Properties) creates empty file for each edited letter #2930

Closed eriharriso closed 3 weeks ago

eriharriso commented 2 months ago

What I was doing: changed the path to my sqlite Data Store in the Data Store Properties URL menu ("Database:" text box). Specifically, I changed the name of the data store from "ines-spec" to "ines-spec_only_structure".

image

What happened: empty sqlite files were created in the same folder for each letter I added to the new name (see figure).

image

What I expected: for Toolbox to simply look for the data store in the specified path without creating any extra files.

Version: installed from source in Sep 10 2024.

ptsavol commented 2 months ago

@eriharriso Should be fixed now.

soininen commented 2 months ago

You still get an empty file when you finish editing if the database points to a non-existing path. I think the real culprit here could be _ValidationTask.run() or someplace else where we call check_database_url() before properly checking if the SQLite file exists (note that other, non-file based databases do not have files).

Also, please revert the textChanged -> editingFinished change. Using the editingFinished signal to track changes in LineEdits forces users to press Enter or accept their edit in some other way to apply the changes which just does not feel natural. Wiring the updates to textChanged makes the UI more fluid.

ptsavol commented 2 months ago

'The fix' has been reverted.